Remove old frontend
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
15
apps/console/src/hooks/useFetchQuery.ts
Normal file
15
apps/console/src/hooks/useFetchQuery.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useQuery, type UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
/**
|
||||
* Wrapper around useQuery to fetch data from an API endpoint
|
||||
*/
|
||||
export function useFetchQuery<T>(
|
||||
url: string,
|
||||
options?: Omit<UseQueryOptions<T>, "queryKey" | "queryFn">
|
||||
) {
|
||||
return useQuery<T>({
|
||||
...options,
|
||||
queryKey: [url],
|
||||
queryFn: () => fetch(url).then((res) => res.json()),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user