css 수정 홈 api payment api
This commit is contained in:
29
src/entities/home/api/use-home-month-mutation.ts
Normal file
29
src/entities/home/api/use-home-month-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL_HOME } from '@/shared/api/api-url-home';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
HomeMonthParams,
|
||||
HomeMonthResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const homeMonth = (params: HomeMonthParams) => {
|
||||
return resultify(
|
||||
axios.post<HomeMonthResponse>(API_URL_HOME.homeMonth(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useHomeMonthwMutation = (options?: UseMutationOptions<HomeMonthResponse, CBDCAxiosError, HomeMonthParams>) => {
|
||||
const mutation = useMutation<HomeMonthResponse, CBDCAxiosError, HomeMonthParams>({
|
||||
...options,
|
||||
mutationFn: (params: HomeMonthParams) => homeMonth(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user