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:
parent
3fe93c2b22
commit
4d4f853792
1 changed files with 2 additions and 1 deletions
|
|
@ -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(),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue