mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-25 22:55:32 +02:00
🚨 Adds null check for appConfig
This commit is contained in:
parent
cd4956b1df
commit
a95c91a380
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section>
|
||||||
<p>{{ getUserState }}</p>
|
|
||||||
<SearchBar ref="SearchBar"
|
<SearchBar ref="SearchBar"
|
||||||
@user-is-searchin="userIsTypingSomething"
|
@user-is-searchin="userIsTypingSomething"
|
||||||
v-if="searchVisible"
|
v-if="searchVisible"
|
||||||
@ -14,7 +13,7 @@
|
|||||||
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
|
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
|
||||||
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
|
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
|
||||||
@modalChanged="modalChanged" />
|
@modalChanged="modalChanged" />
|
||||||
<AuthButtons v-if="getUserState != 'noone'" :userType="getUserState" />
|
<AuthButtons v-if="userState != 'noone'" :userType="userState" />
|
||||||
</div>
|
</div>
|
||||||
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
|
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
|
||||||
<button @click="toggleSettingsVisibility()"
|
<button @click="toggleSettingsVisibility()"
|
||||||
@ -114,8 +113,8 @@ export default {
|
|||||||
* Note that if auth is enabled, but not guest access, and user not logged in,
|
* Note that if auth is enabled, but not guest access, and user not logged in,
|
||||||
* then they will never be able to view the homepage, so no button needed
|
* then they will never be able to view the homepage, so no button needed
|
||||||
*/
|
*/
|
||||||
getUserState() {
|
userState() {
|
||||||
return getUserState(this.appConfig);
|
return getUserState(this.appConfig || {});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -127,6 +127,6 @@ export const getUserState = (appConfig) => {
|
|||||||
const users = appConfig.auth || []; // Get auth object
|
const users = appConfig.auth || []; // Get auth object
|
||||||
if (!isAuthEnabled(users)) return notConfigured; // No auth enabled
|
if (!isAuthEnabled(users)) return notConfigured; // No auth enabled
|
||||||
if (isLoggedIn(users)) return loggedIn; // User is logged in
|
if (isLoggedIn(users)) return loggedIn; // User is logged in
|
||||||
if (isGuestAccessEnabled(appConfig || {})) return guestAccess; // Guest is viewing
|
if (isGuestAccessEnabled(appConfig)) return guestAccess; // Guest is viewing
|
||||||
return notConfigured;
|
return notConfigured;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user