fix(auth): header
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
"use client"
|
||||
|
||||
import { usePermissionStore } from "@/components/label/store/auth"
|
||||
import AppLayout from "@/components/layout/AppLayout"
|
||||
import { PathnameRecorder } from "@/components/layout/PathnameRecorder"
|
||||
import { componentList, showList } from "@/components/layout/common"
|
||||
import { useMemo } from "react"
|
||||
|
||||
// async function getMenu() {
|
||||
// return [...componentList, ...showList]
|
||||
// }
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const menu = [...componentList, ...showList]
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
const detailInfo = usePermissionStore((s) => s.detailInfo)
|
||||
|
||||
const menu = useMemo(() => {
|
||||
if (detailInfo?.roles?.length) {
|
||||
return [...componentList, ...showList]
|
||||
} else {
|
||||
return [...componentList, ...showList].filter(
|
||||
(item) => item.title !== "管理中心"
|
||||
)
|
||||
}
|
||||
}, [detailInfo?.roles?.length])
|
||||
|
||||
return (
|
||||
<AppLayout menu={menu}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user