mirror of
https://github.com/ngthanhvu/kr-phim.git
synced 2026-08-10 14:07:47 +00:00
feat: thêm ít avatar
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
if (to.path !== '/thanh-vien') return
|
||||
|
||||
const { data: user, error } = await useFetch('/api/auth/me', {
|
||||
headers: useRequestHeaders(['cookie']),
|
||||
})
|
||||
|
||||
if (error.value?.statusCode === 401 || !user.value) {
|
||||
return navigateTo('/')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user