feat: 페이지 권한 처리 작업

This commit is contained in:
2025-05-08 09:05:06 +09:00
parent 041b59e498
commit 3ae4504128
6 changed files with 75 additions and 13 deletions
@@ -1,23 +1,29 @@
import { createStore } from "zustand/vanilla";
import type { MenuItem } from "@/entities/menu";
import type { PageMenuAuthority } from "@/entities/menu-authority";
export type MenuState = {
currentMenuInfo: MenuItem | null;
pageMenuAuthority: PageMenuAuthority | null;
};
export type MenuActions = {
setCurrentMenuInfo: (menu: MenuItem) => void;
setPageMenuAuthority: (authority: PageMenuAuthority) => void;
};
export type MenuStore = MenuState & MenuActions;
export const defaultInitState: MenuState = {
currentMenuInfo: null,
pageMenuAuthority: null,
};
export const createMenuStore = (initState: MenuState = defaultInitState) => {
return createStore<MenuStore>()((set) => ({
...initState,
setCurrentMenuInfo: (menu: MenuItem) => set({ currentMenuInfo: menu }),
setPageMenuAuthority: (authority: PageMenuAuthority) =>
set({ pageMenuAuthority: authority }),
}));
};