Skip to content

Commit

Permalink
fix: add throw redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentina DOrazio committed Jul 31, 2024
1 parent fa9b216 commit 95b60af
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/pages/backoffice.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ if (sessionCookie) {
user = await auth.getUser(decodedCookie.uid);
//if the user is not an organizer redirect to 404.astro
if (!user?.customClaims?.organizer) {
try {
Astro.response.status = 404;
Astro.redirect("/404");
throw Astro.redirect("/404");
} catch (e) {
console.log(e);
}
}
} else {
Astro.response.status = 404;
Astro.redirect("/404");
try {
Astro.response.status = 404;
throw Astro.redirect("/404");
} catch (e) {
console.log(e);
}
}
---

Expand Down

0 comments on commit 95b60af

Please sign in to comment.