Browse Source

fix(nc-gui): reset state token and user after signout

pull/5905/head
Wing-Kam Wong 2 years ago
parent
commit
df7ee748c5
  1. 8
      packages/nc-gui/composables/useGlobal/actions.ts

8
packages/nc-gui/composables/useGlobal/actions.ts

@ -8,12 +8,14 @@ export function useGlobalActions(state: State): Actions {
/** Sign out by deleting the token from localStorage */ /** Sign out by deleting the token from localStorage */
const signOut: Actions['signOut'] = async () => { const signOut: Actions['signOut'] = async () => {
state.token.value = null
state.user.value = null
try { try {
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
await nuxtApp.$api.auth.signout() await nuxtApp.$api.auth.signout()
} catch {} } catch {
} finally {
state.token.value = null
state.user.value = null
}
} }
/** Sign in by setting the token in localStorage */ /** Sign in by setting the token in localStorage */

Loading…
Cancel
Save