mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-22 19:45:56 +00:00
Compare commits
1 commit
0f31fe3246
...
97d41f45c8
Author | SHA1 | Date | |
---|---|---|---|
|
97d41f45c8 |
1 changed files with 11 additions and 22 deletions
|
@ -211,21 +211,6 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener("scroll", this.onScroll);
|
window.addEventListener("scroll", this.onScroll);
|
||||||
|
|
||||||
// Retrieve the toast message from localStorage
|
|
||||||
const toastMessage = localStorage.getItem("toastMessage");
|
|
||||||
|
|
||||||
if (toastMessage) {
|
|
||||||
/**
|
|
||||||
* If a toast message exists in localStorage:
|
|
||||||
* 1. Parse the message from string to object format.
|
|
||||||
* 2. Display the toast notification using the root component's toastRes method.
|
|
||||||
* 3. Remove the message from localStorage to prevent it from showing again.
|
|
||||||
*/
|
|
||||||
this.$root.toastRes(JSON.parse(toastMessage)); // Show the toast message
|
|
||||||
localStorage.removeItem("toastMessage"); // Clean up the localStorage
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
window.removeEventListener("scroll", this.onScroll);
|
window.removeEventListener("scroll", this.onScroll);
|
||||||
|
@ -348,19 +333,23 @@ export default {
|
||||||
// Delete each selected monitor
|
// Delete each selected monitor
|
||||||
Object.keys(this.selectedMonitors).forEach(id => {
|
Object.keys(this.selectedMonitors).forEach(id => {
|
||||||
this.$root.deleteMonitor(id, (res) => {
|
this.$root.deleteMonitor(id, (res) => {
|
||||||
|
// Display a response message for the operation
|
||||||
|
this.$root.toastRes(res);
|
||||||
|
|
||||||
|
// Remove the monitor from the selection if deletion is successful
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
// Remove the monitor from the selectedMonitors list upon successful deletion
|
|
||||||
delete this.selectedMonitors[id];
|
delete this.selectedMonitors[id];
|
||||||
|
|
||||||
// Refresh the page immediately after deleting the selected monitors
|
|
||||||
window.location.reload();
|
|
||||||
|
|
||||||
// Store a flag in localStorage to trigger a toast notification once the page reloads
|
|
||||||
localStorage.setItem("toastMessage", JSON.stringify(res));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Delay for UI updates before reloading the page
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!Object.keys(this.selectedMonitors).length) {
|
||||||
|
window.location.reload(); // Refresh the page to show updates
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
// Exit selection mode as deletion is in progress
|
// Exit selection mode as deletion is in progress
|
||||||
this.cancelSelectMode();
|
this.cancelSelectMode();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue