import {useMutation, useQueryClient} from 'react-query';
import axios from 'axios';
interface userInterface {
email: string;
password: string;
}
const loginUser = (user:userInterface) => {
return axios.post('http://127.0.0.0/login',user);
};
export const useLoginApi = () => {
interface BodyInterface {
email: string;
password: string;
}
interface ErrorInterface {
status: string;
}
const {
mutate: loginUserMutator,
isError,
error,
} = useMutation<BodyInterface, ErrorInterface>(loginUser);
return {
loginUserMutator,
isError,
error,
};
};
In here loginUser function showing as an error saying,
No overload matches this call.The last overload gave the following error.Argument of type '() => Promise<AxiosResponse<any, any>>' is not assignable to parameter of type 'MutationKey'.ts(2769).useMutation.d.ts(6, 25): The last overload is declared here.