summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/addresses_controller.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/controllers/api/addresses_controller.rb b/app/controllers/api/addresses_controller.rb
index dbd77d9..834f721 100644
--- a/app/controllers/api/addresses_controller.rb
+++ b/app/controllers/api/addresses_controller.rb
@@ -9,6 +9,16 @@ module Api
render json: serialized_collection.serializable_hash, status: :ok
end
+ def show
+ @address = current_user_account.addresses.find_by(id: params[:id])
+
+ if @address.nil?
+ render status: :not_found
+ else
+ render json: serialized_object.serializable_hash, status: :ok
+ end
+ end
+
def create
@service = Addresses::CreateAddressService.new(current_user_account, service_params)
@@ -40,7 +50,8 @@ module Api
render json: serialized_object.serializable_hash, status: :ok
end
rescue ActiveRecord::RecordNotUnique
- render json: { error_message: 'Ya cuenta con esta dirección' }, status: :unprocessable_entity
+ @address = current_user_account.addresses.find(params[:id])
+ render json: serialized_object.serializable_hash, status: :ok
end
end