From 352282bbdcbfec38a05ee0ca6b0fa620b40b3c45 Mon Sep 17 00:00:00 2001 From: "ThetaLog(n)" Date: Fri, 23 Jan 2026 19:30:43 +0100 Subject: [PATCH 1/3] refactor: simplify session casting and improve type safety in MyMentorshipPage --- frontend/src/app/my/mentorship/page.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/my/mentorship/page.tsx b/frontend/src/app/my/mentorship/page.tsx index f622a68a66..b315f721e2 100644 --- a/frontend/src/app/my/mentorship/page.tsx +++ b/frontend/src/app/my/mentorship/page.tsx @@ -21,7 +21,8 @@ const MyMentorshipPage: React.FC = () => { const router = useRouter() const searchParams = useSearchParams() const { data: session } = useSession() - const username = (session as ExtendedSession)?.user?.login + const extendedSession = session as ExtendedSession | null; + const username = extendedSession?.user?.login; const initialQuery = searchParams.get('q') || '' const initialPage = Number.parseInt(searchParams.get('page') || '1', 10) @@ -58,7 +59,7 @@ const MyMentorshipPage: React.FC = () => { fetchPolicy: 'cache-and-network', errorPolicy: 'all', }) - const isProjectLeader = (session as ExtendedSession)?.user.isLeader + const isProjectLeader = extendedSession?.user?.isLeader; useEffect(() => { if (programData?.myPrograms) { From 3482c4f4cd2ff7072eceed55dde5a3a1d4e08acf Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Fri, 23 Jan 2026 16:57:24 -0800 Subject: [PATCH 2/3] Update code --- frontend/src/app/my/mentorship/page.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/my/mentorship/page.tsx b/frontend/src/app/my/mentorship/page.tsx index b315f721e2..b4fd332747 100644 --- a/frontend/src/app/my/mentorship/page.tsx +++ b/frontend/src/app/my/mentorship/page.tsx @@ -20,9 +20,10 @@ import SearchPageLayout from 'components/SearchPageLayout' const MyMentorshipPage: React.FC = () => { const router = useRouter() const searchParams = useSearchParams() + const { data: session } = useSession() - const extendedSession = session as ExtendedSession | null; - const username = extendedSession?.user?.login; + const extendedSession = session as ExtendedSession | null + const userName = extendedSession?.user?.login const initialQuery = searchParams.get('q') || '' const initialPage = Number.parseInt(searchParams.get('page') || '1', 10) @@ -59,7 +60,7 @@ const MyMentorshipPage: React.FC = () => { fetchPolicy: 'cache-and-network', errorPolicy: 'all', }) - const isProjectLeader = extendedSession?.user?.isLeader; + const isProjectLeader = extendedSession?.user?.isLeader useEffect(() => { if (programData?.myPrograms) { @@ -82,7 +83,7 @@ const MyMentorshipPage: React.FC = () => { const handleCreate = () => router.push('/my/mentorship/programs/create') - if (!username) { + if (!userName) { return } From 5777a8bee24417b62f51151b03f3a635a4281b21 Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Fri, 23 Jan 2026 17:23:47 -0800 Subject: [PATCH 3/3] Update code --- frontend/src/types/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/types/auth.ts b/frontend/src/types/auth.ts index 55e9962dc8..03133284e1 100644 --- a/frontend/src/types/auth.ts +++ b/frontend/src/types/auth.ts @@ -8,13 +8,13 @@ export type ExtendedProfile = { export type ExtendedSession = Session & { accessToken?: string user?: Session['user'] & { + email?: string expires?: string + image?: string isLeader?: boolean isMentor?: boolean isOwaspStaff?: boolean login?: string name?: string - email?: string - image?: string } }