From 15a67994211e190aa81386cc9ac5ff09b6a72999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ko=CC=88rner?= Date: Wed, 5 May 2021 22:01:56 +0200 Subject: [PATCH] add links to public pages --- components/Shell.tsx | 3 ++- pages/api/auth/[...nextauth].tsx | 16 +++++++++++++++- pages/availability/index.tsx | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/components/Shell.tsx b/components/Shell.tsx index bafbd3869a..386832c02c 100644 --- a/components/Shell.tsx +++ b/components/Shell.tsx @@ -66,6 +66,7 @@ export default function Shell(props) { { profileDropdownExpanded && (
+ Your Public Page Your Profile Login & Security @@ -137,4 +138,4 @@ export default function Shell(props) {
); -} \ No newline at end of file +} diff --git a/pages/api/auth/[...nextauth].tsx b/pages/api/auth/[...nextauth].tsx index 2b16e94c88..18236db166 100644 --- a/pages/api/auth/[...nextauth].tsx +++ b/pages/api/auth/[...nextauth].tsx @@ -40,4 +40,18 @@ export default NextAuth({ } }) ], -}); \ No newline at end of file + callbacks: { + async jwt(token, user, account, profile, isNewUser) { + // Add username to the token right after signin + if (user?.username) { + token.username = user.username + } + return token; + }, + async session(session, token) { + session.user = session.user || {} + session.user.username = token.username; + return session; + }, + }, +}); diff --git a/pages/availability/index.tsx b/pages/availability/index.tsx index 9369a0b019..e6fdba9c70 100644 --- a/pages/availability/index.tsx +++ b/pages/availability/index.tsx @@ -158,7 +158,7 @@ export default function Availability(props) { {eventType.length} minutes - {eventType.hidden && View} + View Edit @@ -381,4 +381,4 @@ export async function getServerSideProps(context) { return { props: {user, types}, // will be passed to the page component as props } -} \ No newline at end of file +}