const onClickHandler = async () => {
putInternationalCountryCode(countryCode);
}
};
const { mutate: putInternationalCountryCode, isLoading, isError } = postInternationalCountryCode();
export const postInternationalCountryCode = () => {
const queryClient = useQueryClient();
const history = useHistory();
return useMutation(
async (countryCode) =>
await axios({
url: foo,
method: "put",
data: bar,
responseType: "json"
}),
{
onSuccess: () => {
queryClient.invalidateQueries(["user"]);
},
onSettled: () => {
history.push("/toTheDashboard");
}
}
);
};
const onClickHandler = async () => {
putInternationalCountryCode(countryCode);
}
};
const { mutate: putInternationalCountryCode, isLoading, isError } = postInternationalCountryCode();
export const postInternationalCountryCode = () => {
const queryClient = useQueryClient();
const history = useHistory();
return useMutation(
async (countryCode) =>
await axios({
url: foo,
method: "put",
data: bar,
responseType: "json"
}),
{
onSuccess: () => {
queryClient.invalidateQueries(["user"]);
},
onSettled: () => {
history.push("/toTheDashboard");
}
}
);
};