fix: cycle & module mutation , feat: cycle & module toast alerts (#962)
* fix: cycle remove issue mutation * fix: module remove issue mutation * feat: issue removed toast alert added
This commit is contained in:
parent
f0f24b6fc4
commit
0b9b4bb289
5 changed files with 57 additions and 10 deletions
|
|
@ -314,10 +314,26 @@ export const IssuesView: React.FC<Props> = ({
|
|||
);
|
||||
|
||||
const removeIssueFromCycle = useCallback(
|
||||
(bridgeId: string) => {
|
||||
(bridgeId: string, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId || !cycleId) return;
|
||||
|
||||
mutate(CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params));
|
||||
mutate(
|
||||
CYCLE_ISSUES_WITH_PARAMS(cycleId as string, params),
|
||||
(prevData: any) => {
|
||||
if (!prevData) return prevData;
|
||||
if (selectedGroup) {
|
||||
const filteredData: any = {};
|
||||
for (const key in prevData) {
|
||||
filteredData[key] = prevData[key].filter((item: any) => item.id !== issueId);
|
||||
}
|
||||
return filteredData;
|
||||
} else {
|
||||
const filteredData = prevData.filter((i: any) => i.id !== issueId);
|
||||
return filteredData;
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
issuesService
|
||||
.removeIssueFromCycle(
|
||||
|
|
@ -326,6 +342,13 @@ export const IssuesView: React.FC<Props> = ({
|
|||
cycleId as string,
|
||||
bridgeId
|
||||
)
|
||||
.then(() => {
|
||||
setToastAlert({
|
||||
title: "Success",
|
||||
message: "Issue removed successfully.",
|
||||
type: "success",
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
|
|
@ -334,10 +357,26 @@ export const IssuesView: React.FC<Props> = ({
|
|||
);
|
||||
|
||||
const removeIssueFromModule = useCallback(
|
||||
(bridgeId: string) => {
|
||||
(bridgeId: string, issueId: string) => {
|
||||
if (!workspaceSlug || !projectId || !moduleId) return;
|
||||
|
||||
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
|
||||
mutate(
|
||||
MODULE_ISSUES_WITH_PARAMS(moduleId as string, params),
|
||||
(prevData: any) => {
|
||||
if (!prevData) return prevData;
|
||||
if (selectedGroup) {
|
||||
const filteredData: any = {};
|
||||
for (const key in prevData) {
|
||||
filteredData[key] = prevData[key].filter((item: any) => item.id !== issueId);
|
||||
}
|
||||
return filteredData;
|
||||
} else {
|
||||
const filteredData = prevData.filter((item: any) => item.id !== issueId);
|
||||
return filteredData;
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
modulesService
|
||||
.removeIssueFromModule(
|
||||
|
|
@ -346,6 +385,13 @@ export const IssuesView: React.FC<Props> = ({
|
|||
moduleId as string,
|
||||
bridgeId
|
||||
)
|
||||
.then(() => {
|
||||
setToastAlert({
|
||||
title: "Success",
|
||||
message: "Issue removed successfully.",
|
||||
type: "success",
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue