Backup before moving state to app.js
This commit is contained in:
5
client/src/graphql/initial-state.js
Normal file
5
client/src/graphql/initial-state.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
currentSelectedNavItem: null,
|
||||||
|
currentUser: null,
|
||||||
|
token: null
|
||||||
|
};
|
||||||
@@ -7,6 +7,7 @@ import { createHttpLink } from "apollo-link-http";
|
|||||||
import { InMemoryCache } from "apollo-cache-inmemory";
|
import { InMemoryCache } from "apollo-cache-inmemory";
|
||||||
import { ApolloClient } from "apollo-boost";
|
import { ApolloClient } from "apollo-boost";
|
||||||
import { typeDefs, resolvers } from "./graphql/resolvers";
|
import { typeDefs, resolvers } from "./graphql/resolvers";
|
||||||
|
import initialState from "./graphql/initial-state";
|
||||||
// require('dotenv').config()
|
// require('dotenv').config()
|
||||||
|
|
||||||
import * as serviceWorker from "./serviceWorker";
|
import * as serviceWorker from "./serviceWorker";
|
||||||
@@ -14,26 +15,23 @@ import * as serviceWorker from "./serviceWorker";
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import { default as App } from "./App/App.container";
|
import { default as App } from "./App/App.container";
|
||||||
|
|
||||||
|
const token = client.readQuery
|
||||||
|
|
||||||
const httpLink = createHttpLink({
|
const httpLink = createHttpLink({
|
||||||
uri: "https://bodyshop-dev-db.herokuapp.com/v1/graphql"
|
uri: "https://bodyshop-dev-db.herokuapp.com/v1/graphql"
|
||||||
});
|
});
|
||||||
|
|
||||||
const cache = new InMemoryCache();
|
|
||||||
|
|
||||||
const client = new ApolloClient({
|
const client = new ApolloClient({
|
||||||
link: httpLink,
|
link: httpLink,
|
||||||
cache,
|
cache: new InMemoryCache(),
|
||||||
typeDefs,
|
typeDefs,
|
||||||
resolvers
|
resolvers
|
||||||
});
|
});
|
||||||
|
|
||||||
client.writeData({
|
client.writeData({
|
||||||
data: {
|
data: initialState
|
||||||
currentSelectedNavItem: null,
|
|
||||||
currentUser: null,
|
|
||||||
authState: null,
|
|
||||||
gqlToken: null
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
|||||||
Reference in New Issue
Block a user