Merged in feature/IO-3026-Enhanced-Notifications (pull request #1909)

feature/IO-3026-Enhanced-Notifications - final revisions
This commit is contained in:
Dave Richer
2024-11-12 22:52:13 +00:00

View File

@@ -179,52 +179,6 @@ export function Manage({ conflict, bodyshop, alerts, setAlerts }) {
}
}, [alerts, displayedAlertIds]);
// useEffect(() => {
// const fetchAlerts = async () => {
// try {
// const response = await fetch(ALERT_FILE_URL);
//
// // Check if the response is OK (status in the range 200-299)
// if (!response.ok) {
// console.error(`Network response was not ok: ${response.status} ${response.statusText}`);
// return; // Exit the function early since we can't proceed
// }
//
// const alerts = await response.json();
//
// // Check if alerts is an array
// if (!Array.isArray(alerts)) {
// console.error("Alerts data is not an array");
// return;
// }
//
// const displayedAlerts = JSON.parse(localStorage.getItem("displayedAlerts") || "[]");
// const alertsNotDisplayed = alerts.filter((alert) => !displayedAlerts.includes(alert.id));
//
// // Display notifications for alerts not yet displayed
// alertsNotDisplayed.forEach((alert) => {
// // Update localStorage immediately to prevent duplicate notifications
// displayedAlerts.push(alert.id);
// localStorage.setItem("displayedAlerts", JSON.stringify(displayedAlerts));
//
// notification.open({
// key: "notification-alerts-" + alert.id,
// message: alert.message,
// description: alert.description,
// type: alert.type || "info",
// duration: 0,
// placement: "bottomRight",
// closable: true
// });
// });
// } catch (error) {
// console.error("Error fetching alerts:", error);
// }
// };
//
// fetchAlerts();
// }, []);
useEffect(() => {
const widgetId = InstanceRenderManager({
imex: "IABVNO4scRKY11XBQkNr",