fix: TypeScript 타입 오류 수정 및 설정 페이지 추가
- BOMItem Omit 타입 시그니처 통일 (useTemplateManagement, SectionsTab, ItemMasterContext) - HeadersInit → Record<string, string> 타입 변경 - Zustand useShallow 마이그레이션 (zustand/react/shallow) - DataTable, ListPageTemplate 제네릭 타입 제약 추가 - 설정 관리 페이지 추가 (직급, 직책, 휴가정책, 근무일정, 권한) - HR 관리 페이지 추가 (급여, 휴가) - 단가관리 페이지 리팩토링 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
import { create } from 'zustand';
|
||||
import { devtools } from 'zustand/middleware';
|
||||
import { shallow } from 'zustand/shallow';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import type { PageConfig, PageType, DynamicFormData } from '@/types/master-data';
|
||||
import { fetchPageConfigByType, invalidatePageConfigCache } from '@/lib/api/master-data';
|
||||
|
||||
@@ -63,12 +63,20 @@ interface MasterDataStore {
|
||||
|
||||
// ===== 초기 상태 =====
|
||||
|
||||
const createEmptyPageConfigs = (): Record<PageType, PageConfig | null> => ({
|
||||
'item-master': null,
|
||||
'quotation': null,
|
||||
'sales-order': null,
|
||||
'formula': null,
|
||||
'pricing': null,
|
||||
});
|
||||
|
||||
const initialState = {
|
||||
pageConfigs: {} as Record<PageType, PageConfig | null>,
|
||||
pageConfigs: createEmptyPageConfigs(),
|
||||
loading: {} as Record<PageType, boolean>,
|
||||
errors: {} as Record<PageType, string | null>,
|
||||
selectedPageType: null,
|
||||
formData: {},
|
||||
selectedPageType: null as PageType | null,
|
||||
formData: {} as Record<string, DynamicFormData>,
|
||||
};
|
||||
|
||||
// ===== sessionStorage 유틸리티 =====
|
||||
@@ -278,7 +286,7 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
});
|
||||
|
||||
set(
|
||||
{ pageConfigs: {} },
|
||||
{ pageConfigs: createEmptyPageConfigs() },
|
||||
false,
|
||||
'invalidateAllConfigs'
|
||||
);
|
||||
@@ -401,7 +409,7 @@ export const useSelectedPageType = () =>
|
||||
*/
|
||||
export const useMasterDataActions = () =>
|
||||
useMasterDataStore(
|
||||
(state) => ({
|
||||
useShallow((state) => ({
|
||||
fetchPageConfig: state.fetchPageConfig,
|
||||
invalidateConfig: state.invalidateConfig,
|
||||
invalidateAllConfigs: state.invalidateAllConfigs,
|
||||
@@ -410,8 +418,7 @@ export const useMasterDataActions = () =>
|
||||
getFormData: state.getFormData,
|
||||
clearFormData: state.clearFormData,
|
||||
reset: state.reset,
|
||||
}),
|
||||
shallow
|
||||
}))
|
||||
);
|
||||
|
||||
// ===== 타입 추출 =====
|
||||
|
||||
Reference in New Issue
Block a user