Skip to content

Commit 913af50

Browse files
committed
fix: error handler to prevent JS error when receive 4xx from API
When the data to save is invalid, the API will return 400 and before this, will erase all settings. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 5e4c3c8 commit 913af50

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/views/Settings/Reminders.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export default {
179179
this.displaySuccessReminderDaysBefore = false
180180
this.displaySuccessReminderDaysBetween = false
181181
this.displaySuccessReminderSendTimer = false
182+
this.loading = true
182183
183184
await axios.post(generateOcsUrl('/apps/libresign/api/v1/admin/reminder'), {
184185
daysBefore: parseInt(this.reminderDaysBefore),
@@ -210,6 +211,12 @@ export default {
210211
}
211212
this.nextRun = response.next_run
212213
})
214+
.catch(() => {
215+
this.nextRun = null
216+
})
217+
.finally(() => {
218+
this.loading = false
219+
})
213220
}, 1000),
214221
formatHourMinute(date) {
215222
if (!date) {

0 commit comments

Comments
 (0)