Skip to content

Instantly share code, notes, and snippets.

@cwalkersp
Created June 5, 2015 22:44
Show Gist options
  • Select an option

  • Save cwalkersp/c8cef4832fd5c3f65eb4 to your computer and use it in GitHub Desktop.

Select an option

Save cwalkersp/c8cef4832fd5c3f65eb4 to your computer and use it in GitHub Desktop.
Commands.requestUpdate(formData, function submitRequestSuccess(data) {
gaTrack('Success', 'Successful Update Submittal');
if ($scope.useAsForm) {
if ($scope.submitClaimedUrl) {
submitClaimed();
}
$window.location.assign($scope.formSuccessUrl);
} else if (!$scope.formSuccessUrl) { /* ADDED LINE */
$scope.modalBody = 'Your update request is being processed and you should see your changes on publishers within 24-48 hours.';
$scope.showOkButton = true;
} /* ADDED LINE */
}, function submitRequestError(data) {
resetController();
gaTrack('Error', 'Unsuccessful Update Submittal');
// Status 413 Request Entity Too Large
if (data.status === 413) {
$scope.errors = 'An image or file is too large. Your uploads must be less than '
+ RequestUpdateConstants.MAX_UPLOAD_SIZE
+ ' MB.';
} else {
if (data.data && data.data.errors && data.data.errors.error_type) {
switch(data.data.errors.error_type) {
case 'NotEnoughSFRowsError':
$scope.helpErrorMsg = true;
break;
case 'DuplicateMenuNameError':
$scope.errors = 'When creating a new menu you must give it a unique name. You have a draft with that name.';
break;
}
} else {
$scope.errors = genericErrMsg;
}
}
}).$promise.finally(function submitRequestFinally() {
if (!$scope.formSuccessUrl) { /* ADDED LINE */
unFreezePage();
$scope.waitingOnSubmittal = false;
} /* ADDED LINE */
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment