버튼 클릭 함수를 눌렀을 때 서로 관계가 없는 두 개의 mutate를 호출한 뒤, 호출 결과가 isSuccess 일 때 특정 액션을 주고싶었음.
try catch + async await 주면 간단했음.
const handleClickSubmit = async () => {
try {
await apiFn1.mutate({
id,
password,
});
await apiFn2.mutate({
~~~~,
~~~~,
~~~
});
if (apiFn1.isSuccess && apiFn2.isSuccess) {
push(routerPaths.~~);
}
} catch (error) {
console.log(error);
}
};