2024-01-22 11:37:32 +00:00
|
|
|
import useSWR from "swr";
|
|
|
|
import { useEstimate, useLabel, useProjectState } from "./store";
|
|
|
|
|
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
|
|
|
|
|
|
|
// 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
|
|
|
);
|
|
|
|
};
|