|
@@ -212,15 +212,17 @@ const anonResolvers = ['login', 'createUser'];
|
|
|
}
|
|
|
}
|
|
|
const operationMatch = gql.query.match(/\{\s*([a-zA-Z]+)\s*/)
|
|
|
- const operationName = operationMatch[1]
|
|
|
- const authorization = req.headers.authorization
|
|
|
- if (operationName === null || anonResolvers.includes(operationName)){
|
|
|
+ const operationName = gql.operationName || operationMatch[1]
|
|
|
+ console.log('before oper', operationName, operationMatch)
|
|
|
+ if ((!operationName) || anonResolvers.includes(operationName)){
|
|
|
return {
|
|
|
schema: schema,
|
|
|
rootValue: rootResolvers,
|
|
|
graphiql: true,
|
|
|
}
|
|
|
}
|
|
|
+ const authorization = req.headers.authorization
|
|
|
+ console.log(authorization)
|
|
|
|
|
|
if (authorization && authorization.startsWith('Bearer ')){
|
|
|
console.log('token provided')
|
|
@@ -240,6 +242,7 @@ const anonResolvers = ['login', 'createUser'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ console.log('bad end')
|
|
|
}))
|
|
|
|
|
|
|