better server side signin redirects

this makes it so if a user requests a page (not API route) and isn't
signed in, it automatically redirects them to the sign in page (doesn't
show a flash of the error page)
This commit is contained in:
DecDuck
2024-10-23 12:55:38 +11:00
parent c4a3e4e9a7
commit ef13b68592
4 changed files with 136 additions and 88 deletions

View File

@@ -18,15 +18,7 @@ useHead({
title: `${props.error?.statusCode ?? "An unknown error occurred"} | Drop`,
});
const errorCode = props.error?.statusCode;
if (errorCode != undefined) {
switch (errorCode) {
case 403:
case 401:
if (!user.value) signIn();
break;
}
}
console.log(props.error);
</script>
<template>