Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default async function RootLayout({ children }) {
- // get the nonce and use it
- const nonce = headers().get('x-nonce') || "";
- // fetch currently logged in user
- const { data: { userMeta, userProfile } = {} } = await getClient().query(
- GET_USER,
- { userInput: null },
- );
- const user = { ...userMeta, ...userProfile };
- // if user is a club, display the club's logo as profile img
- if (user?.role === "club") {
- const { data: { club } = {} } = await getClient().query(GET_CLUB, {
- clubInput: { cid: user?.uid },
- });
- user.img = club?.logo;
- }
- return (
- <html lang="en">
- <body className={fontClass}>
- <ModeProvider>
- <ThemeRegistry nonce={nonce}>
- <Progressbar />
- <LocalizationWrapper>
- <AuthProvider user={user}>
- <ToastProvider>
- <Navigation />
- <Content>
- <TransitionProvider>{children}</TransitionProvider>
- </Content>
- <Toast />
- </ToastProvider>
- </AuthProvider>
- </LocalizationWrapper>
- </ThemeRegistry>
- </ModeProvider>
- </body>
- </html>
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment