wesbos
02/07/2018, 1:55 AMme
query? It throws an error when the user ins’t logged in - doesn’t seem the best way to handle this because it breaks my app - what should I do instead?wesbos
02/07/2018, 1:56 AMmax
02/07/2018, 11:22 AMexport const user = (parent, args, ctx: Context, info) => {
const Authorization = ctx.request.get('Authorization')
if (!Authorization || Authorization==="null") {
console.log('Authorization is null')
return null
}
const id = getUserId(ctx)
return ctx.db.query.user({ where: { id } }, info)
}
wesbos
02/07/2018, 3:38 PMmax
02/07/2018, 3:54 PMwesbos
02/07/2018, 3:54 PMmax
02/07/2018, 3:54 PMmax
02/07/2018, 3:56 PMwesbos
02/07/2018, 4:16 PMwesbos
02/07/2018, 4:16 PMmax
02/08/2018, 8:45 AM