fix: redirect after register
All checks were successful
All checks were successful
This commit is contained in:
parent
bc7fddddcc
commit
22f1ce02d8
@ -12,6 +12,8 @@ if(pb.authStore.isValid){
|
||||
return Astro.redirect("/account")
|
||||
}
|
||||
|
||||
let loged = false
|
||||
|
||||
await AstroUtils.wrap(async () => {
|
||||
if (Astro.request.method !== 'POST'){
|
||||
return
|
||||
@ -26,11 +28,14 @@ await AstroUtils.wrap(async () => {
|
||||
}
|
||||
try{
|
||||
await pb.collection('users').create(request)
|
||||
return Astro.redirect('/account/login')
|
||||
}catch(e){
|
||||
loged = true
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
if (loged) {
|
||||
return Astro.redirect('/account/login')
|
||||
}
|
||||
|
||||
const metadata = {
|
||||
title: 'Register',
|
||||
|
Loading…
x
Reference in New Issue
Block a user