#34 - handle error
This commit is contained in:
parent
1de18c9685
commit
a9c2df766e
1 changed files with 5 additions and 3 deletions
|
|
@ -173,15 +173,17 @@ function readAll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function read(notification) {
|
function read(notification) {
|
||||||
if (!notification.isRead) {
|
if (!notification.id) {
|
||||||
console.log(notification);
|
console.error("Couldn't change notification status because it has no id.");
|
||||||
|
} else if (!notification.isRead) {
|
||||||
api
|
api
|
||||||
.readNotification(notification.id)
|
.readNotification(notification.id)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
router.push(toPath(notification.location.href));
|
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) {
|
function toPath(string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue