GraphQL bugfixes and simplifications
This commit is contained in:
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user