feat: 페이지 권한 처리 작업
This commit is contained in:
@@ -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 }),
|
||||
}));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user