add errors for duplicate labels (#2706)
Co-authored-by: rahulramesha <rahul@appsmith.com>
This commit is contained in:
parent
8d3853b129
commit
b56d188a83
3 changed files with 46 additions and 5 deletions
|
|
@ -18,6 +18,7 @@ import { Plus, X } from "lucide-react";
|
|||
import { IIssue, IIssueLabels } from "types";
|
||||
// fetch-keys
|
||||
import { PROJECT_ISSUE_LABELS } from "constants/fetch-keys";
|
||||
import useToast from "hooks/use-toast";
|
||||
|
||||
type Props = {
|
||||
issueDetails: IIssue | undefined;
|
||||
|
|
@ -44,6 +45,9 @@ export const SidebarLabelSelect: React.FC<Props> = ({
|
|||
const [createLabelForm, setCreateLabelForm] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const {
|
||||
|
|
@ -79,6 +83,14 @@ export const SidebarLabelSelect: React.FC<Props> = ({
|
|||
submitChanges({ labels: [...(issueDetails?.labels ?? []), res.id] });
|
||||
|
||||
setCreateLabelForm(false);
|
||||
})
|
||||
.catch((error) => {
|
||||
setToastAlert({
|
||||
title: "Oops!",
|
||||
type: "error",
|
||||
message: error?.error ?? "Error while adding the label",
|
||||
});
|
||||
reset(formData);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue