From 7089515e47fb6f7e9aa3db4bbbac2d3300ff0048 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 11 Aug 2024 15:32:47 +0900 Subject: feat(frontend): improve error handling of login form --- frontend/app/.server/auth.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'frontend/app/.server/auth.ts') diff --git a/frontend/app/.server/auth.ts b/frontend/app/.server/auth.ts index 943f424..4df0924 100644 --- a/frontend/app/.server/auth.ts +++ b/frontend/app/.server/auth.ts @@ -32,9 +32,12 @@ export type User = components["schemas"]["User"]; // Remix's createCookie() returns "structured" cookies, which cannot be reused directly by non-Remix servers. const tokenCookie = createUnstructuredCookie("albatross_token", cookieOptions); +/** + * @throws Error on failure + */ export async function login(request: Request): Promise { const jwt = await authenticator.authenticate("default", request, { - failureRedirect: request.url, + throwOnError: true, }); const session = await sessionStorage.getSession( -- cgit v1.2.3-70-g09d2