From 9f280caafcdee0f08fad4cf8e06c2779bdbd55ba Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Wed, 15 Sep 2021 01:00:26 +0200 Subject: [PATCH] added query to check if current user is logged in --- internal/schema.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/schema.go b/internal/schema.go index f73c5bc..640bafa 100644 --- a/internal/schema.go +++ b/internal/schema.go @@ -87,6 +87,16 @@ func graphqlSchema() (graphql.Schema, error) { }, nil }, }, + "authorized": &graphql.Field{ + Name: "authorized", + Type: graphql.NewNonNull(graphql.Boolean), + Description: "True if the user is authorized", + Resolve: func(p graphql.ResolveParams) (interface{}, error) { + auth, _ := isAuth(p.Context) + + return auth, nil + }, + }, } mutationFields := graphql.Fields{