diff --git a/app/controllers/api/v1/registrant/registry_locks_controller.rb b/app/controllers/api/v1/registrant/registry_locks_controller.rb index 5100cd748..d431b5cd0 100644 --- a/app/controllers/api/v1/registrant/registry_locks_controller.rb +++ b/app/controllers/api/v1/registrant/registry_locks_controller.rb @@ -9,8 +9,7 @@ module Api def create if @domain.apply_registry_lock - serializer = Serializers::RegistrantApi::Domain.new(@domain) - render json: serializer.to_json + render json: serialized_domain(@domain) else render json: { errors: [{ base: ['Domain cannot be locked'] }] }, status: :unprocessable_entity @@ -19,8 +18,7 @@ module Api def destroy if @domain.remove_registry_lock - serializer = Serializers::RegistrantApi::Domain.new(@domain) - render json: serializer.to_json + render json: serialized_domain(@domain) else render json: { errors: [{ base: ['Domain is not locked'] }] }, status: :unprocessable_entity @@ -46,6 +44,11 @@ module Api ] }, status: :unauthorized and return end + + def serialized_domain(domain) + serializer = Serializers::RegistrantApi::Domain.new(domain) + serializer.to_json + end end end end