plane/apps/app/components/cycles/cycles-list/draft-cycles-list.tsx
Anmol Singh Bhatia c8caa925b1
chore: page and cycle refactor (#1159)
* fix: release note modal fix

* chore: cycle and page endpoint refactor
2023-05-29 18:35:16 +05:30

30 lines
830 B
TypeScript

import { useRouter } from "next/router";
import useSWR from "swr";
// services
import cyclesService from "services/cycles.service";
// components
import { CyclesView } from "components/cycles";
// fetch-keys
import { DRAFT_CYCLES_LIST } from "constants/fetch-keys";
type Props = {
viewType: string | null;
};
export const DraftCyclesList: React.FC<Props> = ({ viewType }) => {
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const { data: draftCyclesList } = useSWR(
workspaceSlug && projectId ? DRAFT_CYCLES_LIST(projectId.toString()) : null,
workspaceSlug && projectId
? () =>
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), "draft")
: null
);
return <CyclesView cycles={draftCyclesList} viewType={viewType} />;
};