From 01740db3668679d45b81e1c83588fd678dc3c49b Mon Sep 17 00:00:00 2001 From: shahdivyank Date: Mon, 2 Sep 2024 01:10:24 -0700 Subject: [PATCH] rename --- utils/api.ts => hooks/useFetch.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename utils/api.ts => hooks/useFetch.ts (73%) diff --git a/utils/api.ts b/hooks/useFetch.ts similarity index 73% rename from utils/api.ts rename to hooks/useFetch.ts index b0307fd..ade7584 100644 --- a/utils/api.ts +++ b/hooks/useFetch.ts @@ -1,10 +1,10 @@ -type API = { +interface API { url: string; method: "GET" | "POST" | "PUT" | "DELETE"; body?: {}; -}; +} -export const api = async ({ url, method, body }: API) => { +export const useFetch = async ({ url, method, body }: API) => { const response = await fetch(url, { method: method, body: JSON.stringify(body),