I'm new with typescript i use react-query try to us mutate but it cause an error
TS2554: Expected 1-2 arguments, but got 3.
iterface:
interface ChangePassword{
email: string;
password: string;
confirmPassword: string
}
function:
const changePasswordOnClick = useMutation<Record<string, string>, unknown, ChangePassword>(
() => axios.post(
url,
{ email, password, new_password}, // all fine
),
{
onSuccess: (req) => {
console.log('Request', req)
},
onError: (newLogin) => {
console.log('onError', newLogin);
},
},
);
Problem (just piece of problem code):
onSubmit={async (data,
{setSubmitting, resetForm})=>{setSubmitting(true)
changePasswordOnClick.mutate(
data.email,
data.password,
data.confirmPassword)} // TS2554: Expected 1-2 arguments, but got 3.
Why i'm getting this error? how to fix it?