#34 - handle error

This commit is contained in:
isUnknown 2024-12-17 14:27:59 +01:00
parent 1de18c9685
commit a9c2df766e

View file

@ -173,15 +173,17 @@ function readAll() {
}
function read(notification) {
if (!notification.isRead) {
console.log(notification);
if (!notification.id) {
console.error("Couldn't change notification status because it has no id.");
} else if (!notification.isRead) {
api
.readNotification(notification.id)
.then((res) => {
router.push(toPath(notification.location.href));
})
.catch((err) => console.log(err));
.catch((err) => console.error("Notification could not be read.", err));
}
router.push(toPath(notification.location.href));
}
function toPath(string) {