mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
32 lines
847 B
TypeScript
32 lines
847 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 { CYCLE_LIST } from "constants/fetch-keys";
|
|
|
|
type Props = {
|
|
viewType: string | null;
|
|
};
|
|
|
|
export const AllCyclesList: React.FC<Props> = ({ viewType }) => {
|
|
const router = useRouter();
|
|
const { workspaceSlug, projectId } = router.query;
|
|
|
|
const { data: allCyclesList } = useSWR(
|
|
workspaceSlug && projectId ? CYCLE_LIST(projectId.toString()) : null,
|
|
workspaceSlug && projectId
|
|
? () =>
|
|
cyclesService.getCyclesWithParams(workspaceSlug.toString(), projectId.toString(), {
|
|
cycle_view: "all",
|
|
})
|
|
: null
|
|
);
|
|
|
|
return <CyclesView cycles={allCyclesList} viewType={viewType} />;
|
|
};
|