Moved files around.

This commit is contained in:
Mike Cao 2024-09-26 16:47:51 -07:00
parent 60cd869407
commit 2cd38f1306
35 changed files with 45 additions and 45 deletions

View file

@ -0,0 +1,20 @@
import * as reactQuery from '@tanstack/react-query';
import { useApi as nextUseApi } from 'next-basics';
import { getClientAuthToken } from 'lib/client';
import { SHARE_TOKEN_HEADER } from 'lib/constants';
import useStore from 'store/app';
const selector = (state: { shareToken: { token?: string } }) => state.shareToken;
export function useApi() {
const shareToken = useStore(selector);
const { get, post, put, del } = nextUseApi(
{ authorization: `Bearer ${getClientAuthToken()}`, [SHARE_TOKEN_HEADER]: shareToken?.token },
process.env.basePath,
);
return { get, post, put, del, ...reactQuery };
}
export default useApi;