forked from github/plane
fix: user cannot create duplicate links (#680)
This commit is contained in:
parent
a63c551e75
commit
1b30e4b57f
@ -153,11 +153,20 @@ export const IssueDetailsSidebar: React.FC<Props> = ({
|
|||||||
|
|
||||||
await issuesService
|
await issuesService
|
||||||
.createIssueLink(workspaceSlug as string, projectId as string, issueDetail.id, payload)
|
.createIssueLink(workspaceSlug as string, projectId as string, issueDetail.id, payload)
|
||||||
.then((res) => {
|
.then(() => mutate(ISSUE_DETAILS(issueDetail.id)))
|
||||||
mutate(ISSUE_DETAILS(issueDetail.id));
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
if (err.status === 400)
|
||||||
|
setToastAlert({
|
||||||
|
type: "error",
|
||||||
|
title: "Error!",
|
||||||
|
message: "This URL already exists for this issue.",
|
||||||
|
});
|
||||||
|
else
|
||||||
|
setToastAlert({
|
||||||
|
type: "error",
|
||||||
|
title: "Error!",
|
||||||
|
message: "Something went wrong. Please try again.",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,14 +107,19 @@ export const ModuleDetailsSidebar: React.FC<Props> = ({
|
|||||||
|
|
||||||
await modulesService
|
await modulesService
|
||||||
.createModuleLink(workspaceSlug as string, projectId as string, moduleId as string, payload)
|
.createModuleLink(workspaceSlug as string, projectId as string, moduleId as string, payload)
|
||||||
.then((res) => {
|
.then(() => mutate(MODULE_DETAILS(moduleId as string)))
|
||||||
mutate(MODULE_DETAILS(moduleId as string));
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
if (err.status === 400)
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "Couldn't create the link. Please try again.",
|
message: "This URL already exists for this module.",
|
||||||
|
});
|
||||||
|
else
|
||||||
|
setToastAlert({
|
||||||
|
type: "error",
|
||||||
|
title: "Error!",
|
||||||
|
message: "Something went wrong. Please try again.",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -343,7 +343,7 @@ class ProjectIssuesServices extends APIService {
|
|||||||
)
|
)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ class ProjectIssuesServices extends APIService {
|
|||||||
)
|
)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user