куча говна
All checks were successful
Deploy / deploy (push) Successful in 4m32s

This commit is contained in:
Никита Круглицкий
2025-10-20 00:10:13 +06:00
parent 31460598ba
commit ec67be8aa6
50 changed files with 1616 additions and 1011 deletions

View File

@@ -0,0 +1,20 @@
import chadApi from '#shared/chad-api'
export default defineNuxtRouteMiddleware(async (to, from) => {
const { me, setMe } = useAuth()
if (!me.value && !from?.name) {
try {
setMe(await chadApi('/me'))
}
catch {
if (to.meta.auth !== 'guest') {
return navigateTo({ name: 'Login' })
}
}
}
if (me.value && to.meta.auth === 'guest') {
return navigateTo('/')
}
})