diff --git a/client/public/assets/icons/person.svg b/client/public/assets/icons/person.svg new file mode 100644 index 0000000..17077a8 --- /dev/null +++ b/client/public/assets/icons/person.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/src/app/api/updateUser/route.ts b/client/src/app/api/updateUser/route.ts index 8e1eedb..b9ce237 100644 --- a/client/src/app/api/updateUser/route.ts +++ b/client/src/app/api/updateUser/route.ts @@ -1,7 +1,7 @@ import config from '@/lib/config'; import type { UserPatches, PatchUserRequest } from '@/lib/types/apiRequests'; import type { PatchUserResponse } from '@/lib/types/apiResponses'; -import { getCookie } from '@/lib/services/CookieService'; +import { getCookie, setCookie } from '@/lib/services/CookieService'; import { CookieType } from '@/lib/types/enums'; import { NextResponse, NextRequest } from 'next/server'; import axios, { AxiosError } from 'axios'; @@ -29,6 +29,7 @@ export async function PATCH(request: NextRequest) { const user: UserPatches = body.user; const updatedUser = await updateCurrentUserProfile(authToken, user); + await setCookie(CookieType.USER, JSON.stringify(updatedUser.user)); return NextResponse.json(updatedUser); } catch (error) { diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx index 5ce670e..343a7e1 100644 --- a/client/src/app/layout.tsx +++ b/client/src/app/layout.tsx @@ -5,6 +5,9 @@ import 'react-toastify/dist/ReactToastify.css'; import type { Metadata } from 'next'; import { DM_Sans } from 'next/font/google'; import { ToastContainer } from 'react-toastify'; +import { getCookie } from '@/lib/services/CookieService'; +import { CookieType } from '@/lib/types/enums'; +import { PrivateProfile } from '@/lib/types/apiResponses'; const dmSans = DM_Sans({ subsets: ['latin'], weight: ['200', '400', '500', '600', '700'] }); @@ -13,12 +16,17 @@ export const metadata: Metadata = { description: "ACM at UCSD's annual hackathon", }; -export default function RootLayout({ children }: { children: React.ReactNode }) { +export default async function RootLayout({ children }: { children: React.ReactNode }) { + let user: PrivateProfile | undefined; + try { + user = JSON.parse(await getCookie(CookieType.USER)); + } catch {} + return ( - + {children}