diff --git a/front/src/pages/account/index.astro b/front/src/pages/account/index.astro index fbb2ced..39a434b 100644 --- a/front/src/pages/account/index.astro +++ b/front/src/pages/account/index.astro @@ -15,4 +15,7 @@ if(!auth.isValid){

Bonjour {user!.name}

+
+ deconnexion +
diff --git a/front/src/pages/account/login.astro b/front/src/pages/account/login.astro index 9ad54b0..6f3cd39 100644 --- a/front/src/pages/account/login.astro +++ b/front/src/pages/account/login.astro @@ -24,13 +24,11 @@ const res = await AstroUtils.wrap(async () => { } try { - await locals.pb.collection('users').authWithPassword(request.user,request.password); + pb.collection('users').authWithPassword(request.user,request.password); + return Astro.redirect("/account") } catch (error) { console.log(error) } - - return Astro.redirect("/account") - }) --- diff --git a/front/src/pages/account/logout.astro b/front/src/pages/account/logout.astro new file mode 100644 index 0000000..28472f1 --- /dev/null +++ b/front/src/pages/account/logout.astro @@ -0,0 +1,13 @@ +--- +import PocketBase from 'pocketbase' + + +const pb = Astro.locals.pb as PocketBase + +if(pb.authStore.isValid){ + pb.authStore.clear() +} + +return Astro.redirect('/account/login') + +--- \ No newline at end of file