remove invitation when reject or accept
This commit is contained in:
parent
46939d4b64
commit
8cd9182a8b
|
@ -245,7 +245,7 @@ export default defineComponent({
|
||||||
tooltip: 'Einladung löschen',
|
tooltip: 'Einladung löschen',
|
||||||
color: 'negative',
|
color: 'negative',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
void store.rejectInvitation(row.id);
|
void store.rejectInvitation(row.id).then(() => {
|
||||||
onRequest({
|
onRequest({
|
||||||
pagination: pagination.value,
|
pagination: pagination.value,
|
||||||
filter: () => [],
|
filter: () => [],
|
||||||
|
@ -257,6 +257,7 @@ export default defineComponent({
|
||||||
if (notification !== undefined) {
|
if (notification !== undefined) {
|
||||||
void mainStore.removeNotification(notification.id);
|
void mainStore.removeNotification(notification.id);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const accept = {
|
const accept = {
|
||||||
|
@ -264,7 +265,7 @@ export default defineComponent({
|
||||||
tooltip: 'Einladung annehmen',
|
tooltip: 'Einladung annehmen',
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
void store.acceptInvitation(row.id);
|
void store.acceptInvitation(row.id).then(() => {
|
||||||
onRequest({
|
onRequest({
|
||||||
pagination: pagination.value,
|
pagination: pagination.value,
|
||||||
filter: () => [],
|
filter: () => [],
|
||||||
|
@ -276,6 +277,7 @@ export default defineComponent({
|
||||||
if (notification !== undefined) {
|
if (notification !== undefined) {
|
||||||
void mainStore.removeNotification(notification.id);
|
void mainStore.removeNotification(notification.id);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (sender) {
|
if (sender) {
|
||||||
|
|
|
@ -204,13 +204,21 @@ export const useEventStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
async rejectInvitation(invite: FG.Invitation | number) {
|
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) {
|
async acceptInvitation(invite: FG.Invitation | number) {
|
||||||
return api.put(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`, {
|
try {
|
||||||
|
await api.put(`/events/invitations/${typeof invite === 'number' ? invite : invite.id}`, {
|
||||||
accept: true,
|
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