Class: SolidusGraphqlApi::Mutations::User::RemoveFromAddressBook

Inherits:
BaseMutation
  • Object
show all
Defined in:
lib/solidus_graphql_api/mutations/user/remove_from_address_book.rb

Instance Method Summary collapse

Instance Method Details

#ready?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/solidus_graphql_api/mutations/user/remove_from_address_book.rb', line 19

def ready?(*)
  current_ability.authorize!(:remove_from_address_book, current_user)
end

#resolve(address:) ⇒ Object

Raises:

  • (CanCan::AccessDenied)


13
14
15
16
17
# File 'lib/solidus_graphql_api/mutations/user/remove_from_address_book.rb', line 13

def resolve(address:)
  raise CanCan::AccessDenied unless current_user.remove_from_address_book(address.id)

  { user: current_user.reload }
end