Class: GraphqlDevise::Mutations::Logout

Inherits:
Base
  • Object
show all
Defined in:
lib/graphql_devise/mutations/logout.rb

Instance Method Summary collapse

Instance Method Details

#resolveObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/graphql_devise/mutations/logout.rb', line 6

def resolve
  if current_resource && client && current_resource.tokens[client]
    current_resource.tokens.delete(client)
    current_resource.save!

    remove_resource

    yield current_resource if block_given?

    { authenticatable: current_resource }
  else
    raise_user_error(I18n.t('graphql_devise.user_not_found'))
  end
end