Refactored to use app folder.

This commit is contained in:
Mike Cao committed 2023-09-29 05:29:22 -07:00
1 parent 40cfcd41e9
commit 9a52cdd2e1
258 files changed
+2025 -2258

No files matched your search

+1 -3
View File
@@ -1,4 +1,3 @@
import { useRouter } from 'next/router';
import * as reactQuery from '@tanstack/react-query';
import { useApi as nextUseApi } from 'next-basics';
import { getClientAuthToken } from 'lib/client';
@@ -8,12 +7,11 @@ import useStore from 'store/app';
const selector = state => state.shareToken;
export function useApi() {
const { basePath } = useRouter();
const shareToken = useStore(selector);
const { get, post, put, del } = nextUseApi(
{ authorization: `Bearer ${getClientAuthToken()}`, [SHARE_TOKEN_HEADER]: shareToken?.token },
basePath,
process.env.basePath,
);
return { get, post, put, del, ...reactQuery };