Add option to undismiss a reminder on frontend
This commit is contained in:
committed by
Jože Fortun
parent
8a7b8d9c7f
commit
dc4d146e3d
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user