hurt-tomatoH
Refine2y ago
7 replies
hurt-tomato

how can i remake this 3 functions using refine hooks?

I have this 3 functions that would make a request in a API. How can I achieve this using refine hooks?
This are the functions:
  const arriveStep = async () => {
    await fetch(`${apiURL}/routes/${route?.id}/arrive-step`, {
      method: "PATCH",
    });
    refetch();
  };

  const completeStep = async () => {
    await fetch(`${apiURL}/routes/${route?.id}/complete-step`, {
      method: "PATCH",
    });
    refetch();
  };

  const skipStep = async () => {
    await fetch(`${apiURL}/routes/${route?.id}/skip-step`, {
      method: "PATCH",
    });
    refetch();
  };
Was this page helpful?