mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 02:30:29 +00:00
Update gql config
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
overwrite: true
|
||||||
|
schema: 'https://astrobuild-support-service.herokuapp.com'
|
||||||
|
documents: 'src/graphql/*.api.support.ts'
|
||||||
|
config:
|
||||||
|
withHOC: false
|
||||||
|
scalars:
|
||||||
|
Date: Date
|
||||||
|
enumsAsTypes: true
|
||||||
|
withHooks: true
|
||||||
|
generates:
|
||||||
|
src/graphql/types.support.ts:
|
||||||
|
plugins:
|
||||||
|
- 'typescript'
|
||||||
|
- 'typescript-operations'
|
||||||
+26
-11
@@ -6,6 +6,8 @@ import {
|
|||||||
createHttpLink,
|
createHttpLink,
|
||||||
ApolloProvider,
|
ApolloProvider,
|
||||||
} from '@apollo/client';
|
} from '@apollo/client';
|
||||||
|
import { Elements } from '@stripe/react-stripe-js';
|
||||||
|
import { loadStripe } from '@stripe/stripe-js';
|
||||||
import { setContext } from '@apollo/client/link/context';
|
import { setContext } from '@apollo/client/link/context';
|
||||||
import { ThemeProvider } from 'styled-components';
|
import { ThemeProvider } from 'styled-components';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
@@ -14,10 +16,16 @@ import App from './App';
|
|||||||
import GlobalStyles from './GlobalStyles';
|
import GlobalStyles from './GlobalStyles';
|
||||||
import reportWebVitals from './reportWebVitals';
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
|
||||||
const httpLink = createHttpLink({
|
const stripePromise = loadStripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
|
||||||
|
|
||||||
|
const httpLinkMain = createHttpLink({
|
||||||
uri: process.env.REACT_APP_GRAPHQL_API,
|
uri: process.env.REACT_APP_GRAPHQL_API,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const httpLinkSupport = createHttpLink({
|
||||||
|
uri: process.env.REACT_APP_GRAPHQL_SUPPORT_API,
|
||||||
|
});
|
||||||
|
|
||||||
const authLink = setContext((_, { headers }) => {
|
const authLink = setContext((_, { headers }) => {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
|
|
||||||
@@ -29,21 +37,28 @@ const authLink = setContext((_, { headers }) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const client = new ApolloClient({
|
export const clientMain = new ApolloClient({
|
||||||
link: authLink.concat(httpLink),
|
link: authLink.concat(httpLinkMain),
|
||||||
|
cache: new InMemoryCache(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const clientSupport = new ApolloClient({
|
||||||
|
link: authLink.concat(httpLinkSupport),
|
||||||
cache: new InMemoryCache(),
|
cache: new InMemoryCache(),
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<ApolloProvider client={client}>
|
<Elements stripe={stripePromise}>
|
||||||
<ThemeProvider theme={theme}>
|
<ApolloProvider client={clientMain}>
|
||||||
<BrowserRouter>
|
<ThemeProvider theme={theme}>
|
||||||
<App />
|
<BrowserRouter>
|
||||||
<GlobalStyles />
|
<App />
|
||||||
</BrowserRouter>
|
<GlobalStyles />
|
||||||
</ThemeProvider>
|
</BrowserRouter>
|
||||||
</ApolloProvider>
|
</ThemeProvider>
|
||||||
|
</ApolloProvider>
|
||||||
|
</Elements>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
document.getElementById('root')
|
document.getElementById('root')
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user