Browse Source

fix(nc-gui): reset roles on app load

pull/3701/head
braks 2 years ago
parent
commit
3cf5d5f860
  1. 16
      packages/nc-gui/composables/useGlobal/index.ts

16
packages/nc-gui/composables/useGlobal/index.ts

@ -62,6 +62,22 @@ export const useGlobal = (): UseGlobalReturn => {
{ immediate: true },
)
watch(
state.jwtPayload,
(nextPayload) => {
if (nextPayload) {
state.user.value = {
id: nextPayload.id,
email: nextPayload.email,
firstname: nextPayload.firstname,
lastname: nextPayload.lastname,
roles: nextPayload.roles,
}
}
},
{ immediate: true },
)
const globalState = { ...state, ...getters, ...actions } as UseGlobalReturn
/** provide a fresh state instance into nuxt app */

Loading…
Cancel
Save