chore: duplicate label alert added

This commit is contained in:
Anmol Singh Bhatia 2023-11-07 17:59:00 +05:30
parent f7cc2eca36
commit 3d5cbaae2a

View File

@ -9,6 +9,7 @@ import { Popover, Transition } from "@headlessui/react";
import { IssueLabelService } from "services/issue";
// hooks
import useUser from "hooks/use-user";
import useToast from "hooks/use-toast";
// ui
import { Input } from "@plane/ui";
import { IssueLabelSelect } from "../select";
@ -57,6 +58,8 @@ export const SidebarLabelSelect: React.FC<Props> = ({
defaultValues,
});
const { setToastAlert } = useToast();
const { user } = useUser();
const { data: issueLabels, mutate: issueLabelMutate } = useSWR<IIssueLabels[]>(
@ -79,6 +82,14 @@ export const SidebarLabelSelect: React.FC<Props> = ({
submitChanges({ labels: [...(issueDetails?.labels ?? []), res.id] });
setCreateLabelForm(false);
})
.catch((e) => {
console.log(e);
setToastAlert({
type: "error",
title: "Error!",
message: e.error ? e.error : "Something went wrong. Please try again.",
});
});
};