mirror of
https://github.com/axllent/mailpit.git
synced 2025-08-13 20:04:49 +02:00
Chore: Refactor JS functions and remove unused parameters
This commit is contained in:
@@ -17,7 +17,7 @@ export default {
|
||||
mixins: [CommonMixins],
|
||||
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
$route() {
|
||||
// hide mobile menu on URL change
|
||||
this.hideNav();
|
||||
},
|
||||
|
@@ -52,7 +52,7 @@ export default {
|
||||
let response;
|
||||
try {
|
||||
response = JSON.parse(e.data);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
ws.onclose = (e) => {
|
||||
ws.onclose = () => {
|
||||
if (this.socketLastConnection === 0) {
|
||||
// connection failed immediately after connecting to Mailpit implies proxy websockets aren't configured
|
||||
console.log("Unable to connect to websocket, disabling websocket support");
|
||||
|
@@ -47,14 +47,14 @@ export default {
|
||||
},
|
||||
|
||||
markAllRead() {
|
||||
this.put(this.resolve(`/api/v1/messages`), { read: true }, (response) => {
|
||||
this.put(this.resolve(`/api/v1/messages`), { read: true }, () => {
|
||||
window.scrollInPlace = true;
|
||||
this.loadMessages();
|
||||
});
|
||||
},
|
||||
|
||||
deleteAllMessages() {
|
||||
this.delete(this.resolve(`/api/v1/messages`), false, (response) => {
|
||||
this.delete(this.resolve(`/api/v1/messages`), false, () => {
|
||||
pagination.start = 0;
|
||||
this.loadMessages();
|
||||
});
|
||||
|
@@ -28,7 +28,7 @@ export default {
|
||||
if (!mailbox.selected.length) {
|
||||
return false;
|
||||
}
|
||||
this.put(this.resolve(`/api/v1/messages`), { Read: true, IDs: mailbox.selected }, (response) => {
|
||||
this.put(this.resolve(`/api/v1/messages`), { Read: true, IDs: mailbox.selected }, () => {
|
||||
window.scrollInPlace = true;
|
||||
this.loadMessages();
|
||||
});
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
if (!mailbox.selected.length) {
|
||||
return false;
|
||||
}
|
||||
this.put(this.resolve(`/api/v1/messages`), { Read: false, IDs: mailbox.selected }, (response) => {
|
||||
this.put(this.resolve(`/api/v1/messages`), { Read: false, IDs: mailbox.selected }, () => {
|
||||
window.scrollInPlace = true;
|
||||
this.loadMessages();
|
||||
});
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.delete(this.resolve(`/api/v1/messages`), { IDs: ids }, (response) => {
|
||||
this.delete(this.resolve(`/api/v1/messages`), { IDs: ids }, () => {
|
||||
window.scrollInPlace = true;
|
||||
this.loadMessages();
|
||||
});
|
||||
|
@@ -257,7 +257,10 @@ export default {
|
||||
if (platforms) {
|
||||
try {
|
||||
this.platforms = JSON.parse(platforms);
|
||||
} catch (e) {}
|
||||
} catch {
|
||||
// if parsing fails, reset to default
|
||||
this.platforms = [];
|
||||
}
|
||||
}
|
||||
|
||||
// set all options
|
||||
|
@@ -153,7 +153,7 @@ export default {
|
||||
this.error = error.message;
|
||||
}
|
||||
})
|
||||
.then((result) => {
|
||||
.then(() => {
|
||||
// always run
|
||||
this.loading = false;
|
||||
});
|
||||
|
@@ -143,12 +143,12 @@ export default {
|
||||
window.addEventListener("resize", this.resizeIFrames);
|
||||
|
||||
const headersTab = document.getElementById("nav-headers-tab");
|
||||
headersTab.addEventListener("shown.bs.tab", (event) => {
|
||||
headersTab.addEventListener("shown.bs.tab", () => {
|
||||
this.loadHeaders = true;
|
||||
});
|
||||
|
||||
const rawTab = document.getElementById("nav-raw-tab");
|
||||
rawTab.addEventListener("shown.bs.tab", (event) => {
|
||||
rawTab.addEventListener("shown.bs.tab", () => {
|
||||
this.srcURI = this.resolve("/api/v1/message/" + this.message.ID + "/raw");
|
||||
this.resizeIFrames();
|
||||
});
|
||||
@@ -180,7 +180,7 @@ export default {
|
||||
this.isHTMLTabSelected();
|
||||
|
||||
document.querySelectorAll('button[data-bs-toggle="tab"]').forEach((listObj) => {
|
||||
listObj.addEventListener("shown.bs.tab", (event) => {
|
||||
listObj.addEventListener("shown.bs.tab", () => {
|
||||
this.isHTMLTabSelected();
|
||||
});
|
||||
});
|
||||
@@ -203,7 +203,9 @@ export default {
|
||||
anchorEl.setAttribute("target", "_blank");
|
||||
}
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch {
|
||||
// ignore errors when accessing the iframe content
|
||||
}
|
||||
this.resizeIFrames();
|
||||
}
|
||||
}, 500);
|
||||
@@ -280,7 +282,7 @@ export default {
|
||||
Tags: this.messageTags,
|
||||
};
|
||||
|
||||
this.put(this.resolve("/api/v1/tags"), data, (response) => {
|
||||
this.put(this.resolve("/api/v1/tags"), data, () => {
|
||||
window.scrollInPlace = true;
|
||||
this.$emit("loadMessages");
|
||||
});
|
||||
|
@@ -64,7 +64,7 @@ export default {
|
||||
To: this.addresses,
|
||||
};
|
||||
|
||||
this.post(this.resolve("/api/v1/message/" + this.message.ID + "/release"), data, (response) => {
|
||||
this.post(this.resolve("/api/v1/message/" + this.message.ID + "/release"), data, () => {
|
||||
this.modal("ReleaseModal").hide();
|
||||
if (this.deleteAfterRelease) {
|
||||
this.$emit("delete");
|
||||
|
@@ -14,7 +14,7 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
"mailbox.refresh": function (v) {
|
||||
"mailbox.refresh"(v) {
|
||||
if (v) {
|
||||
// trigger a refresh
|
||||
this.loadMessages();
|
||||
@@ -45,9 +45,9 @@ export default {
|
||||
const params = {};
|
||||
mailbox.selected = [];
|
||||
|
||||
params["limit"] = pagination.limit;
|
||||
params.limit = pagination.limit;
|
||||
if (pagination.start > 0) {
|
||||
params["start"] = pagination.start;
|
||||
params.start = pagination.start;
|
||||
}
|
||||
|
||||
this.get(this.apiURI, params, (response) => {
|
||||
|
@@ -33,7 +33,7 @@ export const mailbox = reactive({
|
||||
|
||||
watch(
|
||||
() => mailbox.count,
|
||||
(v) => {
|
||||
() => {
|
||||
mailbox.selected = [];
|
||||
},
|
||||
);
|
||||
|
@@ -36,7 +36,7 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
$route() {
|
||||
this.loadMailbox();
|
||||
},
|
||||
},
|
||||
|
@@ -94,7 +94,7 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
$route() {
|
||||
this.loadMessage();
|
||||
},
|
||||
},
|
||||
|
@@ -36,7 +36,7 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
$route() {
|
||||
this.doSearch();
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user