GraphQL bugfixes and simplifications

This commit is contained in:
James
2020-05-19 08:47:50 -04:00
parent 698a66f583
commit de6aee192e
4 changed files with 8 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
const createAuthHeaderFromCookie = (req, _, next) => {
if (process.env.NODE_ENV !== 'production' || this.config.productionGraphQLPlayground) {
const createAuthHeaderFromCookie = config => (req, _, next) => {
if (process.env.NODE_ENV !== 'production' || config.productionGraphQLPlayground) {
const existingAuthHeader = req.get('Authorization');
const token = req.cookies[`${this.config.cookiePrefix}-token`];
const token = req.cookies[`${config.cookiePrefix}-token`];
if (!existingAuthHeader && token) {
req.headers.authorization = `JWT ${token}`;