remove invitation when reject or accept
This commit is contained in:
parent
46939d4b64
commit
8cd9182a8b
|
@ -245,18 +245,19 @@ export default defineComponent({
|
|||
tooltip: 'Einladung löschen',
|
||||
color: 'negative',
|
||||
onClick: () => {
|
||||
void store.rejectInvitation(row.id);
|
||||
onRequest({
|
||||
pagination: pagination.value,
|
||||
filter: () => [],
|
||||
getCellValue: () => [],
|
||||
void store.rejectInvitation(row.id).then(() => {
|
||||
onRequest({
|
||||
pagination: pagination.value,
|
||||
filter: () => [],
|
||||
getCellValue: () => [],
|
||||
});
|
||||
const notification = all_notifications.value.find(
|
||||
(n) => (<InvitationData>n.data).invitation === row.id
|
||||
);
|
||||
if (notification !== undefined) {
|
||||
void mainStore.removeNotification(notification.id);
|
||||
}
|
||||
});
|
||||
const notification = all_notifications.value.find(
|
||||
(n) => (<InvitationData>n.data).invitation === row.id
|
||||
);
|
||||
if (notification !== undefined) {
|
||||
void mainStore.removeNotification(notification.id);
|
||||
}
|
||||
},
|
||||
};
|
||||
const accept = {
|
||||
|
@ -264,18 +265,19 @@ export default defineComponent({
|
|||
tooltip: 'Einladung annehmen',
|
||||
color: 'primary',
|
||||
onClick: () => {
|
||||
void store.acceptInvitation(row.id);
|
||||
onRequest({
|
||||
pagination: pagination.value,
|
||||
filter: () => [],
|
||||
getCellValue: () => [],
|
||||
void store.acceptInvitation(row.id).then(() => {
|
||||
onRequest({
|
||||
pagination: pagination.value,
|
||||
filter: () => [],
|
||||
getCellValue: () => [],
|
||||
});
|
||||
const notification = all_notifications.value.find(
|
||||
(n) => (<InvitationData>n.data).invitation === row.id
|
||||
);
|
||||
if (notification !== undefined) {
|
||||
void mainStore.removeNotification(notification.id);
|
||||
}
|
||||
});
|
||||
const notification = all_notifications.value.find(
|
||||
(n) => (<InvitationData>n.data).invitation === row.id
|
||||
);
|
||||
if (notification !== undefined) {
|
||||
void mainStore.removeNotification(notification.id);
|
||||
}
|
||||
},
|
||||
};
|
||||
if (sender) {
|
||||
|
|
|
@ -204,13 +204,21 @@ export const useEventStore = defineStore({
|
|||
},
|
||||
|
||||
async rejectInvitation(invite: FG.Invitation | number) {
|
||||
return api.delete(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`);
|
||||
try {
|
||||
await api.delete(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`);
|
||||
const idx = this.invitations.findIndex((v) => v.id === (invite.id || invite));
|
||||
if (idx >= 0) this.invitations.splice(idx, 1);
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
async acceptInvitation(invite: FG.Invitation | number) {
|
||||
return api.put(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`, {
|
||||
accept: true,
|
||||
});
|
||||
try {
|
||||
await api.put(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`, {
|
||||
accept: true,
|
||||
});
|
||||
const idx = this.invitations.findIndex((v) => v.id === (invite.id || invite));
|
||||
if (idx >= 0) this.invitations.splice(idx, 1);
|
||||
} catch (e) {}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue