Skip to content

Commit

Permalink
feat: for dummy JWT use username from the API (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas2D authored Jan 16, 2025
1 parent c2a7bc2 commit 3e2d9eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/auth/rsc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const ensureSession = async () => {
if (DUMMY_JWT_TOKEN) {
const user = await readUser(DUMMY_JWT_TOKEN);

if (user)
if (user) {
const [firstName = 'Test', lastName = 'User'] =
user.name?.split(' ') ?? [];

return {
user,
access_token: DUMMY_JWT_TOKEN,
Expand All @@ -46,10 +49,11 @@ export const ensureSession = async () => {
metadata: decodeMetadata<UserMetadata>(user.metadata),
name: user.name ?? '',
email: user.email ?? '',
firstName: 'Test',
lastName: 'User',
firstName,
lastName,
},
} as Session;
}
}

const session = await getSession();
Expand Down

0 comments on commit 3e2d9eb

Please sign in to comment.