From b956df34791b329bdc3e96f6ce3c65c7f261dd7c Mon Sep 17 00:00:00 2001 From: silverpill Date: Fri, 14 Jan 2022 19:15:34 +0000 Subject: [PATCH] Enable pagination at notifications page --- src/api/notifications.ts | 5 ++++- src/views/NotificationList.vue | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/api/notifications.ts b/src/api/notifications.ts index 8a098b8..0bc1b97 100644 --- a/src/api/notifications.ts +++ b/src/api/notifications.ts @@ -1,6 +1,6 @@ import { BACKEND_URL } from "@/constants" -import { http } from "./common" +import { PAGE_SIZE, http } from "./common" import { Post } from "./posts" import { Profile } from "./users" @@ -14,10 +14,13 @@ export interface Notification { export async function getNotifications( authToken: string, + maxId?: string, ): Promise { const url = `${BACKEND_URL}/api/v1/notifications` + const queryParams = { max_id: maxId, limit: PAGE_SIZE } const response = await http(url, { method: "GET", + queryParams, authToken, }) const data = await response.json() diff --git a/src/views/NotificationList.vue b/src/views/NotificationList.vue index 38d7cbf..3fc8494 100644 --- a/src/views/NotificationList.vue +++ b/src/views/NotificationList.vue @@ -61,6 +61,13 @@
{{ formatDate(notification.created_at) }}
+ @@ -69,6 +76,7 @@