첫 커밋
This commit is contained in:
29
src/entities/common/api/use-empty-token-change-mutation.ts
Normal file
29
src/entities/common/api/use-empty-token-change-mutation.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
EmptyTokenChangeParams,
|
||||
EmptyTokenChangeResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const emptyTokenChange = (params: EmptyTokenChangeParams) => {
|
||||
return resultify(
|
||||
axios.post<EmptyTokenChangeResponse>(API_URL.emptyTokenChange(), params),
|
||||
);
|
||||
};
|
||||
|
||||
export const useEmptyTokenChangeMutation = (options?: UseMutationOptions<EmptyTokenChangeResponse, CBDCAxiosError, EmptyTokenChangeParams>) => {
|
||||
const mutation = useMutation<EmptyTokenChangeResponse, CBDCAxiosError, EmptyTokenChangeParams>({
|
||||
...options,
|
||||
mutationFn: (params: EmptyTokenChangeParams) => emptyTokenChange(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user