|
|
@ -11,7 +11,7 @@ export const useGlobalState = (): GlobalState => { |
|
|
|
const preferredLanguages = $(usePreferredLanguages()) |
|
|
|
const preferredLanguages = $(usePreferredLanguages()) |
|
|
|
const darkMode = $(usePreferredDark()) |
|
|
|
const darkMode = $(usePreferredDark()) |
|
|
|
|
|
|
|
|
|
|
|
const initialState = { token: undefined, user: undefined, lang: preferredLanguages[0] || 'en', darkMode } |
|
|
|
const initialState = { token: null, user: null, lang: preferredLanguages[0] || 'en', darkMode } |
|
|
|
|
|
|
|
|
|
|
|
const storage = useStorage<State>(storageKey, initialState) |
|
|
|
const storage = useStorage<State>(storageKey, initialState) |
|
|
|
|
|
|
|
|
|
|
@ -20,8 +20,8 @@ export const useGlobalState = (): GlobalState => { |
|
|
|
|
|
|
|
|
|
|
|
// actions
|
|
|
|
// actions
|
|
|
|
function signOut() { |
|
|
|
function signOut() { |
|
|
|
storage.value.token = undefined |
|
|
|
storage.value.token = null |
|
|
|
storage.value.user = undefined |
|
|
|
storage.value.user = null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { ...toRefs(storage.value), signedIn, signOut } |
|
|
|
return { ...toRefs(storage.value), signedIn, signOut } |
|
|
|