From 5cdc44326177c01ae51c9cb441144dc2e7d0b9b5 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Thu, 30 Mar 2023 21:52:35 +0600 Subject: [PATCH] chore: added name in token decode return --- src/components/Login/account-nav.tsx | 2 +- src/lib/utils.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Login/account-nav.tsx b/src/components/Login/account-nav.tsx index 33cb69fba..a35798911 100644 --- a/src/components/Login/account-nav.tsx +++ b/src/components/Login/account-nav.tsx @@ -21,7 +21,7 @@ export default function AccountNavigation() { return (
{isAuthenticated ? ( -
Authenticated: {user?.email}
+
Authenticated: {user?.name}
) : (
Not Authenticated
)} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index aed9d8b04..df91887e2 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -4,10 +4,11 @@ export const TOKEN_COOKIE_NAME = '__timefyi_jt__'; export type TokenPayload = { id: string; email: string; + name: string; }; export function decodeToken(token: string): TokenPayload { const claims = jose.decodeJwt(token); return claims as TokenPayload; -} \ No newline at end of file +}