Skip to content

Commit

Permalink
Hooking in Apollo Client.
Browse files Browse the repository at this point in the history
  • Loading branch information
cebartling committed Dec 5, 2019
1 parent 21539cd commit 1265275
Show file tree
Hide file tree
Showing 5 changed files with 1,920 additions and 611 deletions.
1 change: 1 addition & 0 deletions invest-guru-react-web/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_AUTH0_DOMAIN=
REACT_APP_AUTH0_CLIENT_ID=
REACT_APP_GRAPHQL_URL=
172 changes: 172 additions & 0 deletions invest-guru-react-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions invest-guru-react-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@auth0/auth0-spa-js": "^1.6.0",
"@apollo/client": "3.0.0-beta.14",
"@auth0/auth0-spa-js": "1.6.0",
"@reduxjs/toolkit": "1.1.0",
"bootstrap": "^4.4.1",
"bootstrap": "4.4.1",
"immer": "5.0.0",
"node-sass": "^4.13.0",
"node-sass": "4.13.0",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-icons": "^3.8.0",
"react-icons": "3.8.0",
"react-redux": "7.1.3",
"react-router": "5.1.2",
"react-router-config": "5.1.1",
"react-router-dom": "5.1.2",
"react-scripts": "3.2.0",
"react-scripts": "3.3.0",
"react-transition-group": "^1.x",
"redux": "4.0.4",
"redux-saga": "^1.1.3"
"redux-saga": "1.1.3"
},
"scripts": {
"start": "react-scripts start",
Expand All @@ -42,6 +43,7 @@
]
},
"devDependencies": {
"graphql": "14.5.8",
"redux-immutable-state-invariant": "2.1.0"
}
}
29 changes: 14 additions & 15 deletions invest-guru-react-web/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import createSagaMiddleware from 'redux-saga';
import {helloSaga} from './sagas';
import {Provider} from 'react-redux';
import rootReducer from "./reducers";
import {ApolloClient, HttpLink, InMemoryCache} from '@apollo/client';
import {ApolloProvider} from '@apollo/client';


const sagaMiddleware = createSagaMiddleware();
const store = createStore(
Expand All @@ -21,16 +24,12 @@ sagaMiddleware.run(helloSaga);

const action = type => store.dispatch({type});


// import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
// import { ApolloProvider } from '@apollo/client';
//
// const client = new ApolloClient({
// cache: new InMemoryCache(),
// link: new HttpLink({
// uri: 'https://48p1r2roz4.sse.codesandbox.io',
// })
// });
const client = new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_URL,
})
});

// A function that routes the user to the right place
// after login
Expand All @@ -48,11 +47,11 @@ const WrappedApp = () => (
client_id={process.env.REACT_APP_AUTH0_CLIENT_ID}
redirect_uri={window.location.origin}
onRedirectCallback={onRedirectCallback}>
{/*<ApolloProvider client={client}>*/}
<Provider store={store}>
<App/>
</Provider>
{/*</ApolloProvider>*/}
<ApolloProvider client={client}>
<Provider store={store}>
<App/>
</Provider>
</ApolloProvider>
</Auth0Provider>
);

Expand Down
Loading

0 comments on commit 1265275

Please sign in to comment.