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 AppLayout from "@/components/layout/AppLayout"
|
||||||
import { PathnameRecorder } from "@/components/layout/PathnameRecorder"
|
import { PathnameRecorder } from "@/components/layout/PathnameRecorder"
|
||||||
import { componentList, showList } from "@/components/layout/common"
|
import { componentList, showList } from "@/components/layout/common"
|
||||||
|
import { useMemo } from "react"
|
||||||
|
|
||||||
// async function getMenu() {
|
// async function getMenu() {
|
||||||
// return [...componentList, ...showList]
|
// return [...componentList, ...showList]
|
||||||
// }
|
// }
|
||||||
|
|
||||||
export default async function Layout({
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
children,
|
const detailInfo = usePermissionStore((s) => s.detailInfo)
|
||||||
}: {
|
|
||||||
children: React.ReactNode
|
const menu = useMemo(() => {
|
||||||
}) {
|
if (detailInfo?.roles?.length) {
|
||||||
const menu = [...componentList, ...showList]
|
return [...componentList, ...showList]
|
||||||
|
} else {
|
||||||
|
return [...componentList, ...showList].filter(
|
||||||
|
(item) => item.title !== "管理中心"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}, [detailInfo?.roles?.length])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppLayout menu={menu}>
|
<AppLayout menu={menu}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user