feat: add gender field to user profile and update related components

This commit is contained in:
ngthanhvu
2026-07-24 04:55:39 -04:00
parent 541cb66c33
commit 6ad96873a7
11 changed files with 693 additions and 30 deletions
+7 -4
View File
@@ -1,11 +1,14 @@
export default defineNuxtRouteMiddleware(async (to) => {
if (to.path !== '/thanh-vien') return
const { data: user, error } = await useFetch('/api/auth/me', {
headers: useRequestHeaders(['cookie']),
})
let user = null
try {
user = await $fetch('/api/auth/me')
} catch {
return navigateTo('/')
}
if (error.value?.statusCode === 401 || !user.value) {
if (!user) {
return navigateTo('/')
}
})