Просмотр исходного кода

switch all and unopened category

kaori 4 лет назад
Родитель
Сommit
c8087fee85
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      packages/app/src/components/InAppNotification/InAppNotificationPage.tsx

+ 9 - 2
packages/app/src/components/InAppNotification/InAppNotificationPage.tsx

@@ -24,10 +24,17 @@ const InAppNotificationPageBody: FC<Props> = (props) => {
 
 
 
 
   // commonize notification lists by 81953
   // commonize notification lists by 81953
-  const InAppNotificationCategoryByStatus = (status?) => {
+  const InAppNotificationCategoryByStatus = (status?: string) => {
     const [activePage, setActivePage] = useState(1);
     const [activePage, setActivePage] = useState(1);
     const offset = (activePage - 1) * limit;
     const offset = (activePage - 1) * limit;
-    const { data: notificationData, mutate } = useSWRxInAppNotifications(limit, offset);
+
+    let categoryStatus;
+
+    if (status === 'UNOPENED') {
+      categoryStatus = InAppNotificationStatuses.STATUS_UNOPENED;
+    }
+
+    const { data: notificationData, mutate } = useSWRxInAppNotifications(limit, offset, categoryStatus);
 
 
     const setAllNotificationPageNumber = (selectedPageNumber): void => {
     const setAllNotificationPageNumber = (selectedPageNumber): void => {
       setActivePage(selectedPageNumber);
       setActivePage(selectedPageNumber);