|
|
@ -67,9 +67,6 @@ export const useGlobalState = (): GlobalState => { |
|
|
|
/** State */ |
|
|
|
/** State */ |
|
|
|
const initialState: StoredState = { token: null, user: null, lang: preferredLanguage, darkMode: prefersDarkMode } |
|
|
|
const initialState: StoredState = { token: null, user: null, lang: preferredLanguage, darkMode: prefersDarkMode } |
|
|
|
|
|
|
|
|
|
|
|
/** is sidebar open */ |
|
|
|
|
|
|
|
const sidebarOpen = ref(breakpoints.greater('md').value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** saves a reactive state, any change to these values will write/delete to localStorage */ |
|
|
|
/** saves a reactive state, any change to these values will write/delete to localStorage */ |
|
|
|
const storage = $(useStorage<StoredState>(storageKey, initialState)) |
|
|
|
const storage = $(useStorage<StoredState>(storageKey, initialState)) |
|
|
|
|
|
|
|
|
|
|
@ -88,6 +85,9 @@ export const useGlobalState = (): GlobalState => { |
|
|
|
() => !!(!!token && token !== '' && payload && payload.exp && payload.exp > timestamp / 1000), |
|
|
|
() => !!(!!token && token !== '' && payload && payload.exp && payload.exp > timestamp / 1000), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** is sidebar open */ |
|
|
|
|
|
|
|
const sidebarOpen = ref(signedIn.value && breakpoints.greater('md').value) |
|
|
|
|
|
|
|
|
|
|
|
/** Actions */ |
|
|
|
/** Actions */ |
|
|
|
/** Sign out by deleting the token from localStorage */ |
|
|
|
/** Sign out by deleting the token from localStorage */ |
|
|
|
const signOut: Actions['signOut'] = () => { |
|
|
|
const signOut: Actions['signOut'] = () => { |
|
|
|