첫 커밋
This commit is contained in:
26
src/entities/common/api/use-codes-cache-refresh-mutation.ts
Normal file
26
src/entities/common/api/use-codes-cache-refresh-mutation.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import { CodesCacheRefreshResponse } from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesCacheRefresh = () => {
|
||||
return resultify(
|
||||
axios.post<CodesCacheRefreshResponse>(API_URL.counselList()),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesCacheRefreshMutation = (options?: UseMutationOptions<CodesCacheRefreshResponse, CBDCAxiosError>) => {
|
||||
const mutation = useMutation<CodesCacheRefreshResponse, CBDCAxiosError>({
|
||||
...options,
|
||||
mutationFn: () => codesCacheRefresh(),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user