Skip to content

Commit

Permalink
throw redirect instead of returning
Browse files Browse the repository at this point in the history
prevents `user` being typed as possibly undefined, which svelte-check didn't like
  • Loading branch information
skovati committed Dec 14, 2023
1 parent f5fb845 commit edec687
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { LayoutServerLoad } from './$types';

export const load: LayoutServerLoad = async ({ locals, url }) => {
if (!url.pathname.includes('login') && shouldRedirectToLogin(locals.user)) {
return redirect(302, base);
throw redirect(302, base);
}
return { ...locals };
};

0 comments on commit edec687

Please sign in to comment.