mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
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
|
||||
.createIssueLink(workspaceSlug as string, projectId as string, issueDetail.id, payload)
|
||||
.then((res) => {
|
||||
mutate(ISSUE_DETAILS(issueDetail.id));
|
||||
})
|
||||
.then(() => mutate(ISSUE_DETAILS(issueDetail.id)))
|
||||
.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,15 +107,20 @@ export const ModuleDetailsSidebar: React.FC<Props> = ({
|
||||
|
||||
await modulesService
|
||||
.createModuleLink(workspaceSlug as string, projectId as string, moduleId as string, payload)
|
||||
.then((res) => {
|
||||
mutate(MODULE_DETAILS(moduleId as string));
|
||||
})
|
||||
.then(() => mutate(MODULE_DETAILS(moduleId as string)))
|
||||
.catch((err) => {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: "Couldn't create the link. Please try again.",
|
||||
});
|
||||
if (err.status === 400)
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
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)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
throw error?.response;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class ProjectIssuesServices extends APIService {
|
||||
)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
throw error?.response;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user