From 3e2d9ebd823de34a2c47421d9da0ce9138383e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Dvo=C5=99=C3=A1k?= Date: Thu, 16 Jan 2025 08:44:00 +0100 Subject: [PATCH] feat: for dummy JWT use username from the API (#184) Ref: i-am-bee/bee-api#56 --- src/app/auth/rsc.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/auth/rsc.tsx b/src/app/auth/rsc.tsx index 94d428a..5e71331 100644 --- a/src/app/auth/rsc.tsx +++ b/src/app/auth/rsc.tsx @@ -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, @@ -46,10 +49,11 @@ export const ensureSession = async () => { metadata: decodeMetadata(user.metadata), name: user.name ?? '', email: user.email ?? '', - firstName: 'Test', - lastName: 'User', + firstName, + lastName, }, } as Session; + } } const session = await getSession();