44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import ReactDOM from 'react-dom/client';
|
|
import './index.css';
|
|
import App from './App';
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
import {
|
|
ApolloClient,
|
|
InMemoryCache,
|
|
ApolloProvider,
|
|
createHttpLink,
|
|
} from '@apollo/client';
|
|
import { setContext } from '@apollo/client/link/context';
|
|
import '@emotion/react';
|
|
import { ThemeType } from './layout/styles/themes';
|
|
|
|
const httpLink = createHttpLink({ uri: process.env.REACT_APP_API_URL });
|
|
|
|
const authLink = setContext((_, { headers }) => {
|
|
return {
|
|
headers: headers,
|
|
};
|
|
});
|
|
|
|
const client = new ApolloClient({
|
|
link: authLink.concat(httpLink),
|
|
cache: new InMemoryCache(),
|
|
});
|
|
|
|
const root = ReactDOM.createRoot(
|
|
document.getElementById('root') as HTMLElement,
|
|
);
|
|
root.render(
|
|
<ApolloProvider client={client}>
|
|
<BrowserRouter>
|
|
<App />
|
|
</BrowserRouter>
|
|
</ApolloProvider>,
|
|
);
|
|
|
|
declare module '@emotion/react' {
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
export interface Theme extends ThemeType {}
|
|
}
|