#34 - fix notification count
This commit is contained in:
parent
0cf26819ce
commit
1de18c9685
3 changed files with 9 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ return function($notificationId) {
|
|||
|
||||
$newNotification = null;
|
||||
foreach ($notifications as $key => $notification) {
|
||||
if (!isset($notification['id'])) continue;
|
||||
if ($notification['id'] === $notificationId) {
|
||||
$notifications[$key]['isRead'] = true;
|
||||
$newNotification = $notifications[$key];
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ const { page } = storeToRefs(usePageStore());
|
|||
|
||||
const unreadNotificationsCount = computed(() => {
|
||||
if (!user.value) return undefined;
|
||||
const count = user.value.notifications.map(
|
||||
const count = user.value.notifications.filter(
|
||||
(notification) => notification.isRead
|
||||
).length;
|
||||
if (count === 0) return undefined;
|
||||
|
|
|
|||
|
|
@ -174,12 +174,14 @@ function readAll() {
|
|||
|
||||
function read(notification) {
|
||||
if (!notification.isRead) {
|
||||
api.readNotification(notification.id).then((res) => {
|
||||
console.log(res);
|
||||
// router.push(toPath(notification.location.href));
|
||||
});
|
||||
console.log(notification);
|
||||
api
|
||||
.readNotification(notification.id)
|
||||
.then((res) => {
|
||||
router.push(toPath(notification.location.href));
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
}
|
||||
router.push(toPath(notification.location.href));
|
||||
}
|
||||
|
||||
function toPath(string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue