Class: GraphqlDevise::Mutations::DestroyAccount
- Inherits:
-
Base
- Object
- GraphQL::Schema::Mutation
- Base
- GraphqlDevise::Mutations::DestroyAccount
- Defined in:
- lib/graphql_devise/mutations/destroy_account.rb
Instance Method Summary collapse
Instance Method Details
#resolve ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/graphql_devise/mutations/destroy_account.rb', line 6 def resolve raise_user_error(I18n.t('graphql_devise.user_not_found')) unless current_resource if current_resource.destroy # Clear the controller resource/token so devise_token_auth's `update_auth_header` # after_action doesn't try to reload the now deleted record. remove_resource yield current_resource if block_given? { authenticatable: current_resource } else raise_user_error_list( I18n.t('graphql_devise.destroy_account_failed'), resource: current_resource ) end end |