From ce4e3be9d55ffc026f9776e48de3f0eae9d8f2e5 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 5 Dec 2019 19:46:46 -0800 Subject: [PATCH] Backup before moving state to app.js --- client/src/graphql/initial-state.js | 5 +++++ client/src/index.js | 14 ++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 client/src/graphql/initial-state.js diff --git a/client/src/graphql/initial-state.js b/client/src/graphql/initial-state.js new file mode 100644 index 000000000..8455e0562 --- /dev/null +++ b/client/src/graphql/initial-state.js @@ -0,0 +1,5 @@ +export default { + currentSelectedNavItem: null, + currentUser: null, + token: null +}; diff --git a/client/src/index.js b/client/src/index.js index 29423deab..bd2e8911e 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -7,6 +7,7 @@ import { createHttpLink } from "apollo-link-http"; import { InMemoryCache } from "apollo-cache-inmemory"; import { ApolloClient } from "apollo-boost"; import { typeDefs, resolvers } from "./graphql/resolvers"; +import initialState from "./graphql/initial-state"; // require('dotenv').config() import * as serviceWorker from "./serviceWorker"; @@ -14,26 +15,23 @@ import * as serviceWorker from "./serviceWorker"; import "./index.css"; import { default as App } from "./App/App.container"; +const token = client.readQuery + const httpLink = createHttpLink({ uri: "https://bodyshop-dev-db.herokuapp.com/v1/graphql" }); -const cache = new InMemoryCache(); + const client = new ApolloClient({ link: httpLink, - cache, + cache: new InMemoryCache(), typeDefs, resolvers }); client.writeData({ - data: { - currentSelectedNavItem: null, - currentUser: null, - authState: null, - gqlToken: null - } + data: initialState }); ReactDOM.render(