Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
feat(user): show progress when updating department
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Nov 14, 2022
1 parent 4a66672 commit abd5788
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pages/user/read.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@
label="Department"
:options="selectableDepartments"/>
</div>
<button type="submit" class="update-department-btn btn btn-primary">
update department
</button>
<Suspensible :is-loaded="hasSubmittedDepartment">
<button type="submit" class="update-department-btn btn btn-primary">
update department
</button>
</Suspensible>
</form>

<div class="controls flex justify-between mt-3">
Expand Down Expand Up @@ -342,12 +344,15 @@ async function updateRoles() {
hasSubmittedRole.value = true
}
const hasSubmittedDepartment = ref<boolean>(true)
async function updateDepartment() {
hasSubmittedDepartment.value = false
await fetcher.updateDepartment(user.value.data.id, userDepartment.value).then(() => {
user.value.data.department.data.id = userDepartment.value
})
.then()
.catch(response => extractAllErrorDetails(response, receivedErrors, successMessages))
hasSubmittedDepartment.value = true
}
async function resetUserPassword() {
Expand Down

0 comments on commit abd5788

Please sign in to comment.