fix: toast alert content

This commit is contained in:
Aaryan Khandelwal 2023-08-16 12:12:52 +05:30
parent 66bc3df480
commit d87e149f72
2 changed files with 11 additions and 6 deletions

View File

@ -105,12 +105,6 @@ export const ExistingIssuesListModal: React.FC<Props> = ({
}
handleClose();
setToastAlert({
title: "Success",
type: "success",
message: `Issue${selectedIssues.length > 1 ? "s" : ""} added successfully`,
});
};
useEffect(() => {

View File

@ -9,6 +9,8 @@ import useSWR, { mutate } from "swr";
import { Disclosure, Transition } from "@headlessui/react";
// services
import issuesService from "services/issues.service";
// hooks
import useToast from "hooks/use-toast";
// contexts
import { useProjectMyMembership } from "contexts/project-member.context";
// components
@ -38,6 +40,8 @@ export const SubIssuesList: FC<Props> = ({ parentIssue, user, disabled = false }
const router = useRouter();
const { workspaceSlug } = router.query;
const { setToastAlert } = useToast();
const { memberRole } = useProjectMyMembership();
const { data: subIssuesResponse } = useSWR(
@ -56,6 +60,13 @@ export const SubIssuesList: FC<Props> = ({ parentIssue, user, disabled = false }
await issuesService
.addSubIssues(workspaceSlug as string, parentIssue.project, parentIssue.id, payload)
.then(() =>
setToastAlert({
title: "Success",
type: "success",
message: "Issues added successfully",
})
)
.finally(() => mutate(SUB_ISSUES(parentIssue.id)));
};