plane/apps/app/components/pages/pages-list/other-pages-list.tsx

32 lines
871 B
TypeScript
Raw Permalink Normal View History

import { useRouter } from "next/router";
import useSWR from "swr";
// services
import pagesService from "services/pages.service";
// components
import { PagesView } from "components/pages";
// types
import { TPagesListProps } from "./types";
// fetch-keys
import { OTHER_PAGES_LIST } from "constants/fetch-keys";
export const OtherPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const { data: pages } = useSWR(
workspaceSlug && projectId ? OTHER_PAGES_LIST(projectId as string) : null,
workspaceSlug && projectId
2023-05-26 10:08:44 +00:00
? () =>
pagesService.getPagesWithParams(
workspaceSlug as string,
projectId as string,
"created_by_other"
)
: null
);
return <PagesView pages={pages} viewType={viewType} />;
};