공통코드

This commit is contained in:
focp212@naver.com
2025-10-23 15:27:52 +09:00
parent 86b72b10fa
commit 673d838541
4 changed files with 117 additions and 24 deletions

View File

@@ -22,12 +22,12 @@ export const codesSelect = ({
}: CodesSelectParams) => {
if(method === 'get'){
return resultify(
axios.get<CodesSelectGetResponse>(API_URL.codesSelect()),
axios.get<CodesSelectGetResponse & CodesSelectPostResponse>(API_URL.codesSelect()),
);
}
else{
return resultify(
axios.post<CodesSelectPostResponse>(API_URL.codesSelect(), {
axios.post<CodesSelectGetResponse & CodesSelectPostResponse>(API_URL.codesSelect(), {
codeCl,
colNm,
code1,
@@ -38,8 +38,8 @@ export const codesSelect = ({
}
};
export const useCodesSelectMutation = (options?: UseMutationOptions<CodesSelectGetResponse | CodesSelectPostResponse, CBDCAxiosError, CodesSelectParams>) => {
const mutation = useMutation<CodesSelectGetResponse | CodesSelectPostResponse, CBDCAxiosError, CodesSelectParams>({
export const useCodesSelectMutation = (options?: UseMutationOptions<CodesSelectGetResponse & CodesSelectPostResponse, CBDCAxiosError, CodesSelectParams>) => {
const mutation = useMutation<CodesSelectGetResponse & CodesSelectPostResponse, CBDCAxiosError, CodesSelectParams>({
...options,
mutationFn: ({
codeCl,

View File

@@ -10,6 +10,12 @@ export interface BannerInfoState {
export interface CommonState {
serviceCodes: Array<any>;
setServiceCodes: (update: SetStateAction<Array<any>>) => void;
creditCardList: Array<any>;
setCreditCardList: (update: SetStateAction<Array<any>>) => void;
bankList: Array<any>;
setBankList: (update: SetStateAction<Array<any>>) => void;
virtualBankList: Array<any>;
setVirtualBankList: (update: SetStateAction<Array<any>>) => void;
};
const initialBannerInfoState = {
@@ -51,5 +57,41 @@ export const createCommonStore = lens<CommonState>((set, get) => ({
]
};
});
}
},
setCreditCardList: (update) => {
set((state: CommonState) => {
const newCreditCardList = (typeof update === 'function')
? update(state.creditCardList): update;
return {
...state,
creditCardList: [
...newCreditCardList
]
};
});
},
setBankList: (update) => {
set((state: CommonState) => {
const newBankList = (typeof update === 'function')
? update(state.bankList): update;
return {
...state,
bankList: [
...newBankList
]
};
});
},
setVirtualBankList: (update) => {
set((state: CommonState) => {
const newVirtualBankList = (typeof update === 'function')
? update(state.virtualBankList): update;
return {
...state,
virtualBankList: [
...newVirtualBankList
]
};
});
},
}));

View File

@@ -98,7 +98,7 @@ export interface CodesSelectParams {
colNm?: string;
code1?: string;
code2?: string;
useCl?: string;
useCl?: number;
method: 'get' | 'post';
};
export interface CodeListItem {