fix: cast role string to UserRole enum in auth.ts

Fixes TypeScript build error where JWT claims role (string) was
assigned to User.role (UserRole enum).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
DJP 2026-04-10 13:15:31 -04:00
parent 3fe93c2b22
commit 4d4f853792

View file

@ -1,3 +1,4 @@
import { UserRole } from "./types";
import type { User, LoginResponse } from "./types";
const TOKEN_KEY = "amazon_tc_token";
@ -54,7 +55,7 @@ export function setAuth(response: LoginResponse): void {
id: (claims.sub as string) || "",
email: (claims.email as string) || "",
name: (claims.name as string) || "",
role: ((claims.role as string) || "").toUpperCase(),
role: ((claims.role as string) || "").toUpperCase() as UserRole,
is_active: true,
created_at: new Date().toISOString(),
};