From 1b4217ce079688b8af171330f3e25893f71cb488 Mon Sep 17 00:00:00 2001 From: Brice Sanchez Date: Thu, 14 Mar 2019 13:33:06 -0400 Subject: [PATCH] Set global current_user --- app/graphql/mutations/auth/sign_in.rb | 2 +- app/helpers/graphql/token_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/graphql/mutations/auth/sign_in.rb b/app/graphql/mutations/auth/sign_in.rb index 878dfcb..78b29d8 100644 --- a/app/graphql/mutations/auth/sign_in.rb +++ b/app/graphql/mutations/auth/sign_in.rb @@ -28,7 +28,7 @@ def resolve(email:, password:, remember_me:) if valid_sign_in generate_access_token(user, response) - set_current_user_token(user, context) + set_current_user(user) remember_me ? set_refresh_token(user, response) : delete_refresh_token(user) { diff --git a/app/helpers/graphql/token_helper.rb b/app/helpers/graphql/token_helper.rb index def1718..f3ad4ca 100644 --- a/app/helpers/graphql/token_helper.rb +++ b/app/helpers/graphql/token_helper.rb @@ -16,7 +16,7 @@ def set_refresh_token(user, response) response.set_header 'RefreshToken', refresh_token end - def set_current_user_token(user, context) + def set_current_user(user) context[:current_user] = user end