첫 커밋
This commit is contained in:
33
src/entities/common/api/use-codes-group-by-codeCl-mutaion.ts
Normal file
33
src/entities/common/api/use-codes-group-by-codeCl-mutaion.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import axios from 'axios';
|
||||
import { API_URL } from '@/shared/api/urls';
|
||||
import { resultify } from '@/shared/lib/resultify';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
import {
|
||||
CodesGroupByCodeClParams,
|
||||
CodesGroupByCodeClResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
export const codesGroupByCodeCl = ({ codeCl }: CodesGroupByCodeClParams) => {
|
||||
return resultify(
|
||||
axios.get<CodesGroupByCodeClResponse>(API_URL.codesGroupByCodeCl(codeCl)),
|
||||
);
|
||||
};
|
||||
|
||||
export const useCodesGroupByCodeClMutation = (options?: UseMutationOptions<CodesGroupByCodeClResponse, CBDCAxiosError, CodesGroupByCodeClParams>) => {
|
||||
const mutation = useMutation<CodesGroupByCodeClResponse, CBDCAxiosError, CodesGroupByCodeClParams>({
|
||||
...options,
|
||||
mutationFn: ({
|
||||
codeCl
|
||||
}: CodesGroupByCodeClParams) => codesGroupByCodeCl({
|
||||
codeCl
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user