41 lines
967 B
TypeScript
41 lines
967 B
TypeScript
'use server'
|
|
import {ReactNode} from 'react'
|
|
import {Metadata} from 'next'
|
|
import './globals.css'
|
|
import localFont from 'next/font/local'
|
|
import {Toaster} from '@/components/ui/sonner'
|
|
import StoreProvider from '@/components/providers/StoreProvider'
|
|
import {getProfile} from '@/actions/auth'
|
|
|
|
const font = localFont({
|
|
src: './NotoSansSC-VariableFont_wght.ttf',
|
|
})
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
return {
|
|
title: 'Create Next App',
|
|
description: 'Generated by create next app',
|
|
}
|
|
}
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: ReactNode
|
|
}>) {
|
|
|
|
const result = await getProfile()
|
|
const user = result.success ? result.data : null
|
|
|
|
return (
|
|
<html lang="zh-CN">
|
|
<body className={`${font.className}`}>
|
|
<StoreProvider user={user}>
|
|
{children}
|
|
</StoreProvider>
|
|
<Toaster position={'top-center'} richColors expand/>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|