Skip to content

Commit

Permalink
prompt before archiving email
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenMassaro committed Mar 22, 2024
1 parent 0f442fa commit 48b40c3
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/frontend/src/TableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,22 @@ class TableComponent extends Component<props, state> {
};

archiveMessage = (currentEmail: Email) => {
this.closeReadModal(currentEmail);
this.removeMessageFromState(currentEmail.id);
return fetch("./message/archive?id=" + currentEmail.id, {method: "POST"})
.then((response) => {
if (!response.ok) {
toast.error("Failed to archive '" + currentEmail.subject + "' with error '" + response.statusText + "', readding to list.");
this.addMessageToState(currentEmail);
console.warn(response);
} else {
toast.success("Message '" + currentEmail.subject + "' successfully archived.");
if (window.confirm("Archive this email?")) {
this.closeReadModal(currentEmail);
this.removeMessageFromState(currentEmail.id);
return fetch("./message/archive?id=" + currentEmail.id, {method: "POST"})
.then((response) => {
if (!response.ok) {
toast.error("Failed to archive '" + currentEmail.subject + "' with error '" + response.statusText + "', readding to list.");
this.addMessageToState(currentEmail);
console.warn(response);
} else {
toast.success("Message '" + currentEmail.subject + "' successfully archived.");
}
return response;
}
return response;
}
)
)
}
};

hidePasswordModalIfPasswordNotNeeded = () => {
Expand Down

0 comments on commit 48b40c3

Please sign in to comment.