Add removeInvitation to the invitation screen
This commit is contained in:
@@ -46,6 +46,7 @@ export type { ResolvedInvitationData } from "../utils/resolve-invitation-data.js
|
||||
export type InvitationEventMap = {
|
||||
"invitation-updated": XOInvitation;
|
||||
"invitation-status-changed": string;
|
||||
"invitation-removed": void;
|
||||
error: Error;
|
||||
};
|
||||
|
||||
@@ -889,4 +890,21 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
|
||||
|
||||
return totalSats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the invitation from the Local SQLite db as well as the Engine's internal DB
|
||||
* NOTE: This uses methods that are marked "DANGEROUSLY" inside the engine and behaviour may change
|
||||
*/
|
||||
public async delete() {
|
||||
// Remove the invitation from our local db
|
||||
this.storage.remove(this.data.invitationIdentifier);
|
||||
|
||||
// Remove the invitation from the engine's internal db
|
||||
await this.engine.DANGEROUS_deleteStoredInvitation(this.data.invitationIdentifier);
|
||||
|
||||
this.emit("invitation-removed", this.data.invitationIdentifier);
|
||||
|
||||
// Update the status of the invitation
|
||||
await this.updateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user