mirror of
https://github.com/Nezumi-2711/Sink.git
synced 2026-09-22 20:00:55 +00:00
feat: init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
if (import.meta.server)
|
||||
return
|
||||
|
||||
if (to.path.startsWith('/dashboard') && to.path !== '/dashboard/login') {
|
||||
if (!window.localStorage.getItem('SinkSiteToken'))
|
||||
return navigateTo('/dashboard/login')
|
||||
}
|
||||
|
||||
if (to.path === '/dashboard/login') {
|
||||
try {
|
||||
await useAPI('/api/verify')
|
||||
return navigateTo('/dashboard')
|
||||
}
|
||||
catch (e) {
|
||||
console.warn(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user