diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 16bc99e..d1cec6a 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -8,6 +8,7 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] + const authCode: typeof import('./src/composables/fetch')['authCode'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] const baseFetch: typeof import('./src/composables/fetch')['baseFetch'] const computed: typeof import('vue')['computed'] @@ -309,6 +310,7 @@ declare module 'vue' { interface ComponentCustomProperties { readonly EffectScope: UnwrapRef readonly asyncComputed: UnwrapRef + readonly authCode: UnwrapRef readonly autoResetRef: UnwrapRef readonly baseFetch: UnwrapRef readonly computed: UnwrapRef diff --git a/components.d.ts b/components.d.ts index 4cf89fc..e79f3e6 100644 --- a/components.d.ts +++ b/components.d.ts @@ -14,6 +14,7 @@ declare module 'vue' { Alert: typeof import('./src/components/ui/alert/Alert.vue')['default'] AlertDescription: typeof import('./src/components/ui/alert/AlertDescription.vue')['default'] AlertTitle: typeof import('./src/components/ui/alert/AlertTitle.vue')['default'] + AuthBlock: typeof import('./src/components/AuthBlock.vue')['default'] AutoForm: typeof import('./src/components/ui/auto-form/AutoForm.vue')['default'] AutoFormField: typeof import('./src/components/ui/auto-form/AutoFormField.vue')['default'] AutoFormFieldArray: typeof import('./src/components/ui/auto-form/AutoFormFieldArray.vue')['default'] diff --git a/src/App.vue b/src/App.vue index d193954..021b20e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,7 +34,22 @@ import { SidebarProvider, SidebarRail, } from '~/components/ui/sidebar' +import { authCode } from './composables' +const router = useRouter() + +function logout() { + localStorage.clear() + sessionStorage.clear() + authCode.value = '' + router.push('/auth') +} + +onMounted(() => { + if (!authCode.value) { + router.push('/auth') + } +}) // This is sample data. const data = { user: { @@ -60,7 +75,7 @@ const data = { ], }, { - title: 'Saber', + title: 'SABER', url: '#', icon: 'game-icons:cracked-saber', isActive: true, @@ -139,15 +154,14 @@ const data = {