authentication implementation

This commit is contained in:
HAM!DREZA
2024-05-27 15:13:45 +03:30
parent a984a3937e
commit 021360e364
38 changed files with 1083 additions and 2995 deletions
+11
View File
@@ -0,0 +1,11 @@
export default defineNuxtPlugin(async (nuxtApp) =>{
const { authUser } = useAuth();
try {
const user = await $fetch('/api/auth/me', {
headers : useRequestHeaders(['cookie'])
})
authUser.value = user;
} catch (error) {
authUser.value = null;
}
})