Browse Source

chore(gui-v2): cleanup

pull/2877/head
braks 2 years ago
parent
commit
b99d496ce0
  1. 1
      packages/nc-gui-v2/composables/useGlobal/actions.ts
  2. 4
      packages/nc-gui-v2/composables/useGlobal/state.ts
  3. 1
      packages/nc-gui-v2/middleware/auth.global.ts

1
packages/nc-gui-v2/composables/useGlobal/actions.ts

@ -5,7 +5,6 @@ import { useNuxtApp } from '#imports'
export function useGlobalActions(state: State) { export function useGlobalActions(state: State) {
const { $api } = useNuxtApp() const { $api } = useNuxtApp()
/** 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'] = () => {
state.token.value = null state.token.value = null

4
packages/nc-gui-v2/composables/useGlobal/state.ts

@ -5,9 +5,7 @@ import type { State, StoredState } from './types'
import { computed, ref, toRefs, useNuxtApp, useTimestamp } from '#imports' import { computed, ref, toRefs, useNuxtApp, useTimestamp } from '#imports'
import type { User } from '~/lib' import type { User } from '~/lib'
const storageKey = 'nocodb-gui-v2' export function useGlobalState(storageKey = 'nocodb-gui-v2'): State {
export function useGlobalState(): State {
/** get the preferred languages of a user, according to browser settings */ /** get the preferred languages of a user, according to browser settings */
const preferredLanguages = $(usePreferredLanguages()) const preferredLanguages = $(usePreferredLanguages())
/** todo: reimplement; get the preferred dark mode setting, according to browser settings */ /** todo: reimplement; get the preferred dark mode setting, according to browser settings */

1
packages/nc-gui-v2/middleware/auth.global.ts

@ -25,7 +25,6 @@ export default defineNuxtRouteMiddleware((to, from) => {
/** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */ /** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */
if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) { if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) {
console.log('tosignin')
return navigateTo('/signin') return navigateTo('/signin')
} else if (to.meta.requiresAuth === false && state.signedIn.value) { } else if (to.meta.requiresAuth === false && state.signedIn.value) {
/** /**

Loading…
Cancel
Save