Skip to content

Commit

Permalink
fix(collaborator-modal/client/controller): bugfix for spinner ui (#1858)
Browse files Browse the repository at this point in the history
* fix(collaborator-modal/client/controller): bugfix for spinner ui

* fix(collaborator-modal/client/controller): changes into then/catch blocks

* chore(collaborator-modal/client/controller): removes console log

* style(collaborator-modal/client/controller): removed unneeded lines and cleaned up code
  • Loading branch information
seaerchin authored May 11, 2021
1 parent 879b596 commit 5fb952f
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,18 @@ function CollaboratorModalController(
)

$scope.btnStatus = 2 // pressed; loading
$scope.updatePermissionList(permissionList).catch((err) => {
if (err) {
$scope
.updatePermissionList(permissionList)
.then(() => {
// If no error, clear email input
$scope.btnStatus = 3 // pressed; saved
$scope.closeEditCollaboratorDropdowns()

$timeout(() => {
resetCollabForm()
}, 1000)
})
.catch((err) => {
// Make the alert message correspond to the error code
if (err.response.status === StatusCodes.BAD_REQUEST) {
Toastr.error(
Expand All @@ -250,16 +260,7 @@ function CollaboratorModalController(
Toastr.error('Error adding collaborator.')
}
resetCollabForm()
return
}
// If no error, clear email input
$scope.btnStatus = 3 // pressed; saved
$scope.closeEditCollaboratorDropdowns()

$timeout(() => {
resetCollabForm()
}, 1000)
})
})
}

/**
Expand Down

0 comments on commit 5fb952f

Please sign in to comment.