2024-01-22 11:37:32 +00:00
|
|
|
import useSWR from "swr";
|
2024-02-21 13:50:46 +00:00
|
|
|
import { useCycle, useEstimate, useLabel, useModule, useProjectState } from "./store";
|
2024-01-22 11:37:32 +00:00
|
|
|
|
2024-01-25 08:57:35 +00:00
|
|
|
export const useWorkspaceIssueProperties = (workspaceSlug: string | string[] | undefined) => {
|
2024-01-22 11:37:32 +00:00
|
|
|
const { fetchWorkspaceLabels } = useLabel();
|
|
|
|
|
|
|
|
const { fetchWorkspaceStates } = useProjectState();
|
|
|
|
|
2024-01-25 08:57:35 +00:00
|
|
|
const { fetchWorkspaceEstimates } = useEstimate();
|
2024-01-22 11:37:32 +00:00
|
|
|
|
2024-02-21 13:50:46 +00:00
|
|
|
const { fetchWorkspaceModules } = useModule();
|
|
|
|
|
|
|
|
const { fetchWorkspaceCycles } = useCycle();
|
|
|
|
|
|
|
|
// fetch workspace Modules
|
|
|
|
useSWR(
|
|
|
|
workspaceSlug ? `WORKSPACE_MODULES_${workspaceSlug}` : null,
|
|
|
|
workspaceSlug ? () => fetchWorkspaceModules(workspaceSlug.toString()) : null
|
|
|
|
);
|
|
|
|
|
|
|
|
// fetch workspace Cycles
|
|
|
|
useSWR(
|
|
|
|
workspaceSlug ? `WORKSPACE_CYCLES_${workspaceSlug}` : null,
|
|
|
|
workspaceSlug ? () => fetchWorkspaceCycles(workspaceSlug.toString()) : null
|
|
|
|
);
|
|
|
|
|
2024-01-22 11:37:32 +00:00
|
|
|
// fetch workspace labels
|
|
|
|
useSWR(
|
|
|
|
workspaceSlug ? `WORKSPACE_LABELS_${workspaceSlug}` : null,
|
|
|
|
workspaceSlug ? () => fetchWorkspaceLabels(workspaceSlug.toString()) : null
|
|
|
|
);
|
|
|
|
|
|
|
|
// fetch workspace states
|
|
|
|
useSWR(
|
|
|
|
workspaceSlug ? `WORKSPACE_STATES_${workspaceSlug}` : null,
|
|
|
|
workspaceSlug ? () => fetchWorkspaceStates(workspaceSlug.toString()) : null
|
|
|
|
);
|
|
|
|
|
|
|
|
// fetch workspace estimates
|
|
|
|
useSWR(
|
|
|
|
workspaceSlug ? `WORKSPACE_ESTIMATES_${workspaceSlug}` : null,
|
2024-01-25 08:57:35 +00:00
|
|
|
workspaceSlug ? () => fetchWorkspaceEstimates(workspaceSlug.toString()) : null
|
2024-01-22 11:37:32 +00:00
|
|
|
);
|
|
|
|
};
|