Refactored fetching to use react-query.

This commit is contained in:
Mike Cao 2022-12-28 15:43:22 -08:00
parent 7bbed0e12b
commit c56f02c475
112 changed files with 255 additions and 492 deletions

View file

@ -1,13 +1,12 @@
import { useApi as nextUseApi } from 'next-basics';
import { getClientAuthToken } from 'lib/client';
import { useRouter } from 'next/router';
import * as reactQuery from '@tanstack/react-query';
export function useApi() {
export default function useApi() {
const { basePath } = useRouter();
const { get, post, put, del } = nextUseApi(getClientAuthToken(), basePath);
return { get, post, put, del };
return { get, post, put, del, ...reactQuery };
}
export default useApi;