Fetch jwt token from hasura-auth with refresh_token
This commit is contained in:
@ -3,36 +3,16 @@ 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 { ApolloProvider } from '@apollo/client';
|
||||
import '@emotion/react';
|
||||
import { ThemeType } from './layout/styles/themes';
|
||||
|
||||
const httpLink = createHttpLink({
|
||||
uri: `${process.env.REACT_APP_API_URL}/v1/graphql`,
|
||||
});
|
||||
|
||||
const authLink = setContext((_, { headers }) => {
|
||||
return {
|
||||
headers: { ...headers, 'x-hasura-admin-secret': 'secret' },
|
||||
};
|
||||
});
|
||||
|
||||
const client = new ApolloClient({
|
||||
link: authLink.concat(httpLink),
|
||||
cache: new InMemoryCache(),
|
||||
});
|
||||
import { apiClient } from './apollo';
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement,
|
||||
);
|
||||
root.render(
|
||||
<ApolloProvider client={client}>
|
||||
<ApolloProvider client={apiClient}>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
|
||||
Reference in New Issue
Block a user