const authLink = setContext((_, oldContext) => {
return produce(oldContext, draft => {
if (!draft.headers) {
draft.headers = {};
}
draft.headers["X-SOURCE"] = "browser";
const token = cookie.get("token");
if (token) {
draft.headers["Authorization"] = `bearer ${token}`;
}
});
});
Created
March 10, 2019 12:34
-
-
Save leighhalliday/f95afe7633531c131a51f325446f28f0 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment