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

Commit

Permalink
fix(page): update resource attribute on client
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Nov 22, 2022
1 parent 3d6b164 commit ee256d4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
12 changes: 10 additions & 2 deletions pages/department/read.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,21 @@ async function updateDepartment() {
async function archiveDepartment() {
await fetcher.archive([ department.value.data.id ])
.then(() => fillSuccessMessages(receivedErrors, successMessages))
.then(() => {
if (!department.value.data.deletedAt) department.value.data.deletedAt = new Date()
fillSuccessMessages(receivedErrors, successMessages)
})
.catch(responseWithErrors => extractAllErrorDetails(responseWithErrors, receivedErrors))
}
async function restoreDepartment() {
await fetcher.restore([ department.value.data.id ])
.then(() => fillSuccessMessages(receivedErrors, successMessages))
.then(() => {
if (department.value.data.deletedAt) department.value.data.deletedAt = null
fillSuccessMessages(receivedErrors, successMessages)
})
.catch(responseWithErrors => extractAllErrorDetails(responseWithErrors, receivedErrors))
}
</script>
4 changes: 4 additions & 0 deletions pages/role/read.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ async function updateRole() {
async function archiveRole() {
await fetcher.archive([ role.value.data.id ])
.then(() => {
if (!role.value.data.deletedAt) role.value.data.deletedAt = new Date()
fillSuccessMessages(receivedErrors, successMessages)
})
.catch(responseWithErrors => extractAllErrorDetails(responseWithErrors, receivedErrors))
Expand All @@ -183,6 +185,8 @@ async function archiveRole() {
async function restoreRole() {
await fetcher.restore([ role.value.data.id ])
.then(() => {
if (role.value.data.deletedAt) role.value.data.deletedAt = null
fillSuccessMessages(receivedErrors, successMessages)
})
.catch(responseWithErrors => extractAllErrorDetails(responseWithErrors, receivedErrors))
Expand Down
12 changes: 10 additions & 2 deletions pages/semester/read.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,21 @@ async function updateSemester() {
async function archiveSemester() {
await fetcher.archive([ semester.value.data.id ])
.then(() => fillSuccessMessages(receivedErrors, successMessages))
.then(() => {
if (!semester.value.data.deletedAt) semester.value.data.deletedAt = new Date()
fillSuccessMessages(receivedErrors, successMessages)
})
.catch(responseWithErrors => extractAllErrorDetails(responseWithErrors, receivedErrors))
}
async function restoreSemester() {
await fetcher.restore([ semester.value.data.id ])
.then(() => fillSuccessMessages(receivedErrors, successMessages))
.then(() => {
if (semester.value.data.deletedAt) semester.value.data.deletedAt = null
fillSuccessMessages(receivedErrors, successMessages)
})
.catch(responseWithErrors => extractAllErrorDetails(responseWithErrors, receivedErrors))
}
</script>

0 comments on commit ee256d4

Please sign in to comment.