diff --git a/Client/public/res/js/node.js b/Client/public/res/js/node.js index dd2cf94..7b8d45d 100644 --- a/Client/public/res/js/node.js +++ b/Client/public/res/js/node.js @@ -30,13 +30,15 @@ function addToastToStorage(time, message) { var toasts = [{ 'time': time, 'message': message }] var storedToasts = getStoredToasts(); console.log("Adding new notification to storage: ", toasts); - toasts = toasts.concat(storedToasts); - console.log("Combined new and stored notifications: ", toasts); - toasts = toasts.filter((value, index, self) => - index === self.findIndex((t) => ( - t.time === value.time && t.message === value.message - )) - ) + if (storedToasts) { + toasts = toasts.concat(storedToasts); + console.log("Combined new and stored notifications: ", toasts); + toasts = toasts.filter((value, index, self) => + index === self.findIndex((t) => ( + t.time === value.time && t.message === value.message + )) + ) + } console.log("Deduped stored notifications: ", toasts); localStorage.setItem("toasts", JSON.stringify(toasts)); navbarUpdateNotificationBellCount(toasts); diff --git a/Server/public/res/js/node.js b/Server/public/res/js/node.js index 67ea019..41e8f6c 100644 --- a/Server/public/res/js/node.js +++ b/Server/public/res/js/node.js @@ -30,13 +30,15 @@ function addToastToStorage(time, message) { var toasts = [{ 'time': time, 'message': message }] var storedToasts = getStoredToasts(); console.log("Adding new notification to storage: ", toasts); - toasts = toasts.concat(storedToasts); - console.log("Combined new and stored notifications: ", toasts); - toasts = toasts.filter((value, index, self) => - index === self.findIndex((t) => ( - t.time === value.time && t.message === value.message - )) - ) + if (storedToasts) { + toasts = toasts.concat(storedToasts); + console.log("Combined new and stored notifications: ", toasts); + toasts = toasts.filter((value, index, self) => + index === self.findIndex((t) => ( + t.time === value.time && t.message === value.message + )) + ) + } console.log("Deduped stored notifications: ", toasts); localStorage.setItem("toasts", JSON.stringify(toasts)); navbarUpdateNotificationBellCount(toasts);