fga-eps-mds/2019.2-Vsign

View on GitHub
frontend/src/graphql/client.js

Summary

Maintainability
A
0 mins
Test Coverage
import  ApolloClient from "apollo-boost";

export const client = new ApolloClient({
    uri: 'http://localhost:3000/graphql',
    fetchOptions: {
        credentials: 'include'
    },
    request: operation => {
        const token = sessionStorage.getItem("userToken");
        operation.setContext({
            headers: {
                Authorization: token ? `Bearer ${token}` : ""
            }
        });
    }
});