mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
c8caa925b1
* fix: release note modal fix * chore: cycle and page endpoint refactor
28 lines
824 B
TypeScript
28 lines
824 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 { FAVORITE_PAGES_LIST } from "constants/fetch-keys";
|
|
|
|
export const FavoritePagesList: React.FC<TPagesListProps> = ({ viewType }) => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { data: pages } = useSWR(
|
|
workspaceSlug && projectId ? FAVORITE_PAGES_LIST(projectId as string) : null,
|
|
workspaceSlug && projectId
|
|
? () =>
|
|
pagesService.getPagesWithParams(workspaceSlug as string, projectId as string, "favorite")
|
|
: null
|
|
);
|
|
|
|
return <PagesView pages={pages} viewType={viewType} />;
|
|
};
|