fix: redirect after register
All checks were successful
Build Docker Image Front / run (pull_request) Successful in 1m34s
Build Docker Image Back / run (pull_request) Successful in 23s
JsDocs / coverage (pull_request) Successful in 23s
Test and coverage / coverage (pull_request) Successful in 1m34s

This commit is contained in:
Clement 2024-05-21 09:54:39 +02:00
parent bc7fddddcc
commit 22f1ce02d8

View File

@ -12,6 +12,8 @@ if(pb.authStore.isValid){
return Astro.redirect("/account") return Astro.redirect("/account")
} }
let loged = false
await AstroUtils.wrap(async () => { await AstroUtils.wrap(async () => {
if (Astro.request.method !== 'POST'){ if (Astro.request.method !== 'POST'){
return return
@ -26,11 +28,14 @@ await AstroUtils.wrap(async () => {
} }
try{ try{
await pb.collection('users').create(request) await pb.collection('users').create(request)
return Astro.redirect('/account/login') loged = true
}catch(e){ }catch(e){
console.log(e); console.log(e);
} }
}) })
if (loged) {
return Astro.redirect('/account/login')
}
const metadata = { const metadata = {
title: 'Register', title: 'Register',