Add removeInvitation to the invitation screen
This commit is contained in:
@@ -67,6 +67,7 @@ export class AppService extends EventEmitter<AppEventMap> {
|
||||
{
|
||||
onUpdated: (invitation: XOInvitation) => void;
|
||||
onStatusChanged: (status: string) => void;
|
||||
onRemoved: () => void;
|
||||
}
|
||||
>();
|
||||
|
||||
@@ -241,13 +242,25 @@ export class AppService extends EventEmitter<AppEventMap> {
|
||||
invitationIdentifier,
|
||||
});
|
||||
};
|
||||
const onRemoved = () => {
|
||||
this.detachInvitationListeners(invitationIdentifier);
|
||||
this.invitations.splice(this.invitations.indexOf(invitation), 1);
|
||||
this.bumpInvitationRevision(invitationIdentifier);
|
||||
this.emit("invitation-removed", invitation);
|
||||
this.emit("wallet-state-changed", {
|
||||
reason: "invitation-removed",
|
||||
invitationIdentifier: invitationIdentifier,
|
||||
});
|
||||
};
|
||||
|
||||
invitation.on("invitation-updated", onUpdated);
|
||||
invitation.on("invitation-status-changed", onStatusChanged);
|
||||
invitation.on("invitation-removed", onRemoved);
|
||||
|
||||
this.invitationEventCleanup.set(invitationIdentifier, {
|
||||
onUpdated,
|
||||
onStatusChanged,
|
||||
onRemoved,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user