Shun Miyazawa 1 год назад
Родитель
Сommit
9f4c9d49ab
1 измененных файлов с 12 добавлено и 0 удалено
  1. 12 0
      apps/app/src/stores/page-listing.tsx

+ 12 - 0
apps/app/src/stores/page-listing.tsx

@@ -29,6 +29,18 @@ export const useSWRxPagesByPath = (path?: Nullable<string>): SWRResponse<IPageHa
   );
   );
 };
 };
 
 
+export const useSWRxPagesByPaths = (
+    paths?: string[], userGroups?: string[], isIncludeEmpty?: boolean, includeAnyoneWithTheLink?: boolean,
+): SWRResponse<IPageHasId[], Error> => {
+  return useSWR(
+    (paths != null && paths.length !== 0) ? ['/page/pages', paths, userGroups, isIncludeEmpty, includeAnyoneWithTheLink] : null,
+    ([endpoint, paths, userGroups, isIncludeEmpty, includeAnyoneWithTheLink]) => apiv3Get(
+      endpoint, {
+        paths, userGroups, isIncludeEmpty, includeAnyoneWithTheLink,
+      },
+    ).then(result => result.data.pages),
+  );
+};
 
 
 type RecentApiResult = {
 type RecentApiResult = {
   pages: IPageHasId[],
   pages: IPageHasId[],