mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-27 02:43:55 +03:00
🚨 Adds null check for appConfig
This commit is contained in:
parent
cd4956b1df
commit
a95c91a380
@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<section>
|
||||
<p>{{ getUserState }}</p>
|
||||
<SearchBar ref="SearchBar"
|
||||
@user-is-searchin="userIsTypingSomething"
|
||||
v-if="searchVisible"
|
||||
@ -14,7 +13,7 @@
|
||||
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
|
||||
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
|
||||
@modalChanged="modalChanged" />
|
||||
<AuthButtons v-if="getUserState != 'noone'" :userType="getUserState" />
|
||||
<AuthButtons v-if="userState != 'noone'" :userType="userState" />
|
||||
</div>
|
||||
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
|
||||
<button @click="toggleSettingsVisibility()"
|
||||
@ -114,8 +113,8 @@ export default {
|
||||
* 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
|
||||
*/
|
||||
getUserState() {
|
||||
return getUserState(this.appConfig);
|
||||
userState() {
|
||||
return getUserState(this.appConfig || {});
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
@ -127,6 +127,6 @@ export const getUserState = (appConfig) => {
|
||||
const users = appConfig.auth || []; // Get auth object
|
||||
if (!isAuthEnabled(users)) return notConfigured; // No auth enabled
|
||||
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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user