가맹점 정보, 일부 상수 및 공용 변경
This commit is contained in:
29
src/entities/merchant/api/use-merchant-mid-mutation.tsx
Normal file
29
src/entities/merchant/api/use-merchant-mid-mutation.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_MERCHANT } from '@/shared/api/api-url-merchant';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
MerchantMidParams,
|
||||
MerchantMidResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const merchantMid = (params: MerchantMidParams) => {
|
||||
return resultify(
|
||||
axios.post<MerchantMidResponse>(API_URL_MERCHANT.merchantMid(params.mid), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useMerchantMidMutation = (options?: UseMutationOptions<MerchantMidResponse, CBDCAxiosError, MerchantMidParams>) => {
|
||||
const mutation = useMutation<MerchantMidResponse, CBDCAxiosError, MerchantMidParams>({
|
||||
...options,
|
||||
mutationFn: (params: MerchantMidParams) => merchantMid(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_MERCHANT } from '@/shared/api/api-url-merchant';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
MerchantMidStatusParams,
|
||||
MerchantMidStatusResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const merchantMidStatus = (params: MerchantMidStatusParams) => {
|
||||
return resultify(
|
||||
axios.post<MerchantMidStatusResponse>(API_URL_MERCHANT.merchantMidStatus(params.mid), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useMerchantMidStatusMutation = (options?: UseMutationOptions<MerchantMidStatusResponse, CBDCAxiosError, MerchantMidStatusParams>) => {
|
||||
const mutation = useMutation<MerchantMidStatusResponse, CBDCAxiosError, MerchantMidStatusParams>({
|
||||
...options,
|
||||
mutationFn: (params: MerchantMidStatusParams) => merchantMidStatus(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user