title: How can I wait for mutation execution in React Query?
body: <p>I have two API calls in <code>onVerificationCodeSubmit</code> that covering reset password logic. The problem is that <code>newPasswordMutation</code> executes before <code>setRestorePasswordToken(data.restoreToken)</code> in <code>verifyCodeMutation</code> success callback.</p>
  <p>How can I wait for it?</p>
  <p>Any way I can handle it via React-Query tools?</p>
  <pre><code>  const { mutateAsync: verifyCodeMutation } = useMutation(verifyCode, {
      onSuccess: ({ data }) =&gt; setRestorePasswordToken(data.restoreToken),
    });
  
    const { mutateAsync: newPasswordMutation } = useMutation(createNewPassword, {
      enabled: restorePasswordToken,
      onSuccess: () =&gt; setPasswordResetSuccessfull(true),
    });
  
    const onRestorePasswordSubmit = ({ email }) =&gt; {
      restorePasswordMutation(email);
    };
  
    const onVerificationCodeSubmit = async ({ verificationCode, password }) =&gt; {
      await verifyCodeMutation({ verificationCode, restoreToken });
      newPasswordMutation({ password, restorePasswordToken });
    };
  </code></pre>