27 lines
622 B
TypeScript
27 lines
622 B
TypeScript
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 profile={profile}/>}
|
|
content={props.children}
|
|
/>
|
|
)
|
|
}
|