From 2d5f913a431c4223a16c88551ffff4100ac483c4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 28 Jul 2024 16:01:41 +0900 Subject: feat: implement game entry --- frontend/app/.server/auth.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'frontend/app/.server/auth.ts') diff --git a/frontend/app/.server/auth.ts b/frontend/app/.server/auth.ts index 822d4b9..988b30c 100644 --- a/frontend/app/.server/auth.ts +++ b/frontend/app/.server/auth.ts @@ -39,7 +39,7 @@ export async function isAuthenticated( failureRedirect?: never; headers?: never; }, -): Promise; +): Promise<{ user: User; token: string } | null>; export async function isAuthenticated( request: Request | Session, options: { @@ -55,7 +55,7 @@ export async function isAuthenticated( failureRedirect: string; headers?: HeadersInit; }, -): Promise; +): Promise<{ user: User; token: string }>; export async function isAuthenticated( request: Request | Session, options: { @@ -87,7 +87,7 @@ export async function isAuthenticated( failureRedirect: string; headers?: HeadersInit; } = {}, -): Promise { +): Promise<{ user: User; token: string } | null> { // This function's signature should be compatible with `authenticator.isAuthenticated` but TypeScript does not infer it correctly. let jwt; const { successRedirect, failureRedirect, headers } = options; @@ -114,5 +114,9 @@ export async function isAuthenticated( if (!jwt) { return null; } - return jwtDecode(jwt); + const user = jwtDecode(jwt); + return { + user, + token: jwt, + }; } -- cgit v1.2.3-70-g09d2