- OpenLayers(ol) 패키지 제거 (미사용, import 0건) - common/ 디렉토리 생성: components, hooks, services, store, types, utils - 17개 공통 파일을 common/으로 이동 (git mv, blame 이력 보존) - MainTab 타입을 App.tsx에서 common/types/navigation.ts로 분리 - tsconfig path alias (@common/*, @tabs/*) + vite resolve.alias 설정 - 42개 import 경로를 @common/ alias 또는 상대경로로 수정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
691 B
TypeScript
29 lines
691 B
TypeScript
import { create } from 'zustand'
|
|
import { fetchMenuConfig } from '../services/authApi'
|
|
import type { MenuConfigItem } from '../services/authApi'
|
|
|
|
interface MenuState {
|
|
menuConfig: MenuConfigItem[]
|
|
isLoaded: boolean
|
|
loadMenuConfig: () => Promise<void>
|
|
setMenuConfig: (config: MenuConfigItem[]) => void
|
|
}
|
|
|
|
export const useMenuStore = create<MenuState>((set) => ({
|
|
menuConfig: [],
|
|
isLoaded: false,
|
|
|
|
loadMenuConfig: async () => {
|
|
try {
|
|
const config = await fetchMenuConfig()
|
|
set({ menuConfig: config, isLoaded: true })
|
|
} catch {
|
|
set({ isLoaded: true })
|
|
}
|
|
},
|
|
|
|
setMenuConfig: (config: MenuConfigItem[]) => {
|
|
set({ menuConfig: config })
|
|
},
|
|
}))
|