diff options
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/app/.server/auth.ts | 19 | ||||
| -rw-r--r-- | frontend/app/routes/dashboard.tsx | 4 |
2 files changed, 4 insertions, 19 deletions
diff --git a/frontend/app/.server/auth.ts b/frontend/app/.server/auth.ts index a3496af..394a8b0 100644 --- a/frontend/app/.server/auth.ts +++ b/frontend/app/.server/auth.ts @@ -30,15 +30,7 @@ authenticator.use( "default", ); -type JwtPayload = components["schemas"]["JwtPayload"]; - -export type User = { - userId: number; - username: string; - displayName: string; - iconPath: string | null; - isAdmin: boolean; -}; +export type User = components["schemas"]["JwtPayload"]; export async function isAuthenticated( request: Request | Session, @@ -122,12 +114,5 @@ export async function isAuthenticated( if (!jwt) { return null; } - const payload = jwtDecode<JwtPayload>(jwt); - return { - userId: payload.user_id, - username: payload.username, - displayName: payload.display_name, - iconPath: payload.icon_path ?? null, - isAdmin: payload.is_admin, - }; + return jwtDecode<User>(jwt); } diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx index 407dda6..3ad465f 100644 --- a/frontend/app/routes/dashboard.tsx +++ b/frontend/app/routes/dashboard.tsx @@ -16,12 +16,12 @@ export default function Dashboard() { <div className="p-6 rounded shadow-md max-w-4xl mx-auto"> <h1 className="text-3xl font-bold mb-4"> {user.username}{" "} - {user.isAdmin && <span className="text-red-500 text-lg">admin</span>} + {user.is_admin && <span className="text-red-500 text-lg">admin</span>} </h1> <h2 className="text-2xl font-semibold mb-2">User</h2> <div className="mb-6"> <ul className="list-disc list-inside"> - <li>Name: {user.displayName}</li> + <li>Name: {user.display_name}</li> </ul> </div> <h2 className="text-2xl font-semibold mb-2">Game</h2> |
