-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WEB-838] fix: cycle dropdown fetch (#4076)
* fix: workspace issue properties fetch * fix: issue modal cycle fetch issue * fix: issue modal cycle fetch issue * chore: project issue properties hook updated
- Loading branch information
1 parent
86715f5
commit 3a466cf
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { useCycle, useEstimate, useLabel, useMember, useModule, useProjectState } from "./store"; | ||
|
||
export const useProjectIssueProperties = () => { | ||
const { fetchProjectStates } = useProjectState(); | ||
const { | ||
project: { fetchProjectMembers }, | ||
} = useMember(); | ||
const { fetchProjectLabels } = useLabel(); | ||
const { fetchAllCycles: fetchProjectAllCycles } = useCycle(); | ||
const { fetchModules: fetchProjectAllModules } = useModule(); | ||
const { fetchProjectEstimates } = useEstimate(); | ||
|
||
// fetching project states | ||
const fetchStates = async ( | ||
workspaceSlug: string | string[] | undefined, | ||
projectId: string | string[] | undefined | ||
) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchProjectStates(workspaceSlug.toString(), projectId.toString()); | ||
} | ||
}; | ||
// fetching project members | ||
const fetchMembers = async ( | ||
workspaceSlug: string | string[] | undefined, | ||
projectId: string | string[] | undefined | ||
) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchProjectMembers(workspaceSlug.toString(), projectId.toString()); | ||
} | ||
}; | ||
|
||
// fetching project labels | ||
const fetchLabels = async ( | ||
workspaceSlug: string | string[] | undefined, | ||
projectId: string | string[] | undefined | ||
) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchProjectLabels(workspaceSlug.toString(), projectId.toString()); | ||
} | ||
}; | ||
// fetching project cycles | ||
const fetchCycles = async ( | ||
workspaceSlug: string | string[] | undefined, | ||
projectId: string | string[] | undefined | ||
) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchProjectAllCycles(workspaceSlug.toString(), projectId.toString()); | ||
} | ||
}; | ||
// fetching project modules | ||
const fetchModules = async ( | ||
workspaceSlug: string | string[] | undefined, | ||
projectId: string | string[] | undefined | ||
) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchProjectAllModules(workspaceSlug.toString(), projectId.toString()); | ||
} | ||
}; | ||
// fetching project estimates | ||
const fetchEstimates = async ( | ||
workspaceSlug: string | string[] | undefined, | ||
projectId: string | string[] | undefined | ||
) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchProjectEstimates(workspaceSlug.toString(), projectId.toString()); | ||
} | ||
}; | ||
|
||
const fetchAll = async (workspaceSlug: string | string[] | undefined, projectId: string | string[] | undefined) => { | ||
if (workspaceSlug && projectId) { | ||
await fetchStates(workspaceSlug, projectId); | ||
await fetchMembers(workspaceSlug, projectId); | ||
await fetchLabels(workspaceSlug, projectId); | ||
await fetchCycles(workspaceSlug, projectId); | ||
await fetchModules(workspaceSlug, projectId); | ||
await fetchEstimates(workspaceSlug, projectId); | ||
} | ||
}; | ||
|
||
return { | ||
fetchAll, | ||
fetchStates, | ||
fetchMembers, | ||
fetchLabels, | ||
fetchCycles, | ||
fetchModules, | ||
fetchEstimates, | ||
}; | ||
}; |