Add option to undismiss a reminder on frontend

This commit is contained in:
Atanas Yonkov
2023-02-28 15:24:29 +01:00
committed by Jože Fortun
parent 8a7b8d9c7f
commit dc4d146e3d
3 changed files with 37 additions and 6 deletions
@@ -23,8 +23,7 @@
<b-form-checkbox
data-test-id="checkbox-dismiss-reminder"
:checked="!!r.dismissedAt"
:disabled="!!r.dismissedAt"
@change="$emit('dismiss', r)"
@change="$emit('dismiss', r, $event)"
>
<span
data-test-id="span-reminder-title"
@@ -89,10 +89,16 @@ export default {
this.edit = null
},
onDismiss (r) {
this.$SystemAPI.reminderDismiss(r).then(() => {
this.fetchReminders()
})
onDismiss (r, value) {
if (value) {
this.$SystemAPI.reminderDismiss(r).then(() => {
this.fetchReminders()
})
} else {
this.$SystemAPI.reminderUndismiss(r).then(() => {
this.fetchReminders()
})
}
},
onDelete (r) {
+26
View File
@@ -2590,6 +2590,25 @@ export default class System {
return this.api().request(cfg).then(result => stdResolve(result))
}
// Undismiss reminder
async reminderUndismiss (a: KV, extra: AxiosRequestConfig = {}): Promise<KV> {
const {
reminderID,
} = (a as KV) || {}
if (!reminderID) {
throw Error('field reminderID is empty')
}
const cfg: AxiosRequestConfig = {
...extra,
method: 'patch',
url: this.reminderUndismissEndpoint({
reminderID,
}),
}
return this.api().request(cfg).then(result => stdResolve(result))
}
reminderDismissEndpoint (a: KV): string {
const {
reminderID,
@@ -2597,6 +2616,13 @@ export default class System {
return `/reminder/${reminderID}/dismiss`
}
reminderUndismissEndpoint (a: KV): string {
const {
reminderID,
} = a || {}
return `/reminder/${reminderID}/undismiss`
}
// Snooze reminder
async reminderSnooze (a: KV, extra: AxiosRequestConfig = {}): Promise<KV> {
const {