Handle location form submit errors for (sub)domains
This commit is contained in:
@@ -232,9 +232,8 @@
|
||||
<div class="col-md-12">
|
||||
<fieldset>
|
||||
<form role="form" name="locationForm" ng-submit="location.submit()" autocomplete="off">
|
||||
<div class="has-error text-center" ng-show="location.error.other">{{ location.error.other }}</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': (locationForm.location.$dirty && locationForm.location.$invalid) || (!locationForm.location.$dirty && location.error.location) }">
|
||||
<label class="control-label" for="locationLocationInput">Domain {{ location.error.location }} </label>
|
||||
<label class="control-label" for="locationLocationInput">{{ location.error.location }} </label>
|
||||
<div class="input-group form-inline">
|
||||
<input type="text" class="form-control" ng-model="location.location" id="locationLocationInput" name="location" placeholder="{{ 'Leave empty to use bare domain' }}" autofocus>
|
||||
|
||||
|
||||
@@ -197,6 +197,17 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
};
|
||||
|
||||
Client.configureApp($scope.app.id, 'location', data, function (error) {
|
||||
if (error && error.statusCode === 409) {
|
||||
if (error.location && error.domain) {
|
||||
$scope.location.error.location = error.message;
|
||||
$scope.locationForm.$setPristine();
|
||||
} else {
|
||||
$scope.location.error.alternateDomains = error.message;
|
||||
}
|
||||
|
||||
$scope.location.busy = false;
|
||||
return;
|
||||
}
|
||||
if (error) return Client.error(error);
|
||||
|
||||
$scope.location.success = true;
|
||||
|
||||
Reference in New Issue
Block a user