diff --git a/codegen.yml b/codegen-main.yml similarity index 100% rename from codegen.yml rename to codegen-main.yml diff --git a/codegen-support.yml b/codegen-support.yml new file mode 100644 index 0000000..6343571 --- /dev/null +++ b/codegen-support.yml @@ -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' diff --git a/src/index.tsx b/src/index.tsx index a00f3d0..822fa77 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -6,6 +6,8 @@ import { createHttpLink, ApolloProvider, } from '@apollo/client'; +import { Elements } from '@stripe/react-stripe-js'; +import { loadStripe } from '@stripe/stripe-js'; import { setContext } from '@apollo/client/link/context'; import { ThemeProvider } from 'styled-components'; import { BrowserRouter } from 'react-router-dom'; @@ -14,10 +16,16 @@ import App from './App'; import GlobalStyles from './GlobalStyles'; import reportWebVitals from './reportWebVitals'; -const httpLink = createHttpLink({ +const stripePromise = loadStripe('pk_test_TYooMQauvdEDq54NiTphI7jx'); + +const httpLinkMain = createHttpLink({ uri: process.env.REACT_APP_GRAPHQL_API, }); +const httpLinkSupport = createHttpLink({ + uri: process.env.REACT_APP_GRAPHQL_SUPPORT_API, +}); + const authLink = setContext((_, { headers }) => { const token = localStorage.getItem('token'); @@ -29,21 +37,28 @@ const authLink = setContext((_, { headers }) => { }; }); -const client = new ApolloClient({ - link: authLink.concat(httpLink), +export const clientMain = new ApolloClient({ + link: authLink.concat(httpLinkMain), + cache: new InMemoryCache(), +}); + +export const clientSupport = new ApolloClient({ + link: authLink.concat(httpLinkSupport), cache: new InMemoryCache(), }); ReactDOM.render( - - - - - - - - + + + + + + + + + + , document.getElementById('root') );