实现响应式导航栏组件
This commit is contained in:
@@ -2,16 +2,24 @@ import {ReactNode} from 'react'
|
||||
import Header from './_client/header'
|
||||
import Navbar from './_client/navbar'
|
||||
import Layout from './_client/layout'
|
||||
import {getProfile} from '@/actions/auth'
|
||||
import {redirect} from 'next/navigation'
|
||||
|
||||
export type AdminLayoutProps = {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export default async function AdminLayout(props: AdminLayoutProps) {
|
||||
const resp = await getProfile()
|
||||
const profile = resp.success ? resp.data : null
|
||||
if (!profile) {
|
||||
redirect('/login')
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout
|
||||
navbar={<Navbar/>}
|
||||
header={<Header/>}
|
||||
header={<Header profile={profile}/>}
|
||||
content={props.children}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user