forked from github/plane
c8caa925b1
* fix: release note modal fix * chore: cycle and page endpoint refactor
27 lines
794 B
TypeScript
27 lines
794 B
TypeScript
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 { ALL_PAGES_LIST } from "constants/fetch-keys";
|
|
|
|
export const AllPagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { data: pages } = useSWR(
|
|
workspaceSlug && projectId ? ALL_PAGES_LIST(projectId as string) : null,
|
|
workspaceSlug && projectId
|
|
? () => pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "all")
|
|
: null
|
|
);
|
|
|
|
return <PagesView pages={pages} viewType={viewType} />;
|
|
};
|