Database auth is fully fixed and functional except for outbound firebase.
This commit is contained in:
@@ -3,6 +3,7 @@ import { ApolloProvider } from "react-apollo";
|
||||
import { HttpLink } from "apollo-link-http";
|
||||
import ApolloClient from "apollo-client";
|
||||
import { InMemoryCache } from "apollo-cache-inmemory";
|
||||
import { resolvers, typeDefs } from "../graphql/resolvers";
|
||||
|
||||
//Styling imports
|
||||
import "./App.css";
|
||||
@@ -18,22 +19,18 @@ const graphqlEndpoint =
|
||||
"https://bodyshop-dev-db.herokuapp.com/v1/graphql";
|
||||
|
||||
export default function App({ authState }) {
|
||||
console.log("graphqlEndpoint", graphqlEndpoint);
|
||||
|
||||
const isIn = authState.status === "in";
|
||||
|
||||
const headers = isIn ? { Authorization: `Bearer ${authState.token}` } : {};
|
||||
|
||||
const httpLink = new HttpLink({
|
||||
uri: graphqlEndpoint,
|
||||
headers
|
||||
});
|
||||
|
||||
const client = new ApolloClient({
|
||||
link: httpLink,
|
||||
cache: new InMemoryCache()
|
||||
cache: new InMemoryCache(),
|
||||
resolvers,
|
||||
typeDefs
|
||||
});
|
||||
|
||||
client.writeData({
|
||||
data: initialState
|
||||
});
|
||||
@@ -41,7 +38,7 @@ export default function App({ authState }) {
|
||||
return (
|
||||
<ApolloProvider client={client}>
|
||||
<HeaderAppBarContainer />
|
||||
<SignIn />
|
||||
{isIn ? null : <SignIn />}
|
||||
<JobListContainer />
|
||||
</ApolloProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user