31 lines
988 B
TypeScript
31 lines
988 B
TypeScript
import axios from 'axios';
|
|
import { API_URL_ADDITIONAL_SERVICE } from '@/shared/api/api-url-additional-service';
|
|
import { resultify } from '@/shared/lib/resultify';
|
|
import { CBDCAxiosError } from '@/shared/@types/error';
|
|
import {
|
|
ExtensionCheckParams,
|
|
ExtensionCheckResponse,
|
|
ExtensionListParams,
|
|
ExtensionListResponse
|
|
} from '../model/types';
|
|
import {
|
|
useMutation,
|
|
UseMutationOptions
|
|
} from '@tanstack/react-query';
|
|
|
|
export const extensionCheck = (params: ExtensionCheckParams) => {
|
|
return resultify(
|
|
axios.post<ExtensionCheckResponse>(API_URL_ADDITIONAL_SERVICE.extensionCheck(), params),
|
|
);
|
|
};
|
|
|
|
export const useExtensionCheckMutation = (options?: UseMutationOptions<ExtensionCheckResponse, CBDCAxiosError, ExtensionCheckParams>) => {
|
|
const mutation = useMutation<ExtensionCheckResponse, CBDCAxiosError, ExtensionCheckParams>({
|
|
...options,
|
|
mutationFn: (params: ExtensionCheckParams) => extensionCheck(params),
|
|
});
|
|
|
|
return {
|
|
...mutation,
|
|
};
|
|
}; |