forked from github/plane
feat: issues alerts
This commit is contained in:
parent
1b06b21087
commit
2836161107
@ -174,8 +174,9 @@ export const SingleBoardIssue: React.FC<Props> = ({
|
||||
mutate(MODULE_DETAILS(moduleId as string));
|
||||
} else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params));
|
||||
setToastAlert({
|
||||
type: "info",
|
||||
title: "Issue Updated Successfully",
|
||||
type: "success",
|
||||
title: "Success",
|
||||
message: "Issue updated successfully.",
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -150,8 +150,9 @@ export const SingleListIssue: React.FC<Props> = ({
|
||||
mutate(MODULE_DETAILS(moduleId as string));
|
||||
} else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params));
|
||||
setToastAlert({
|
||||
type: "info",
|
||||
title: "Issue Updated Successfully",
|
||||
type: "success",
|
||||
title: "Success",
|
||||
message: "Issue updated successfully.",
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -179,7 +179,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = ({
|
||||
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
title: "Success",
|
||||
message: "Issue updated successfully.",
|
||||
});
|
||||
})
|
||||
|
@ -58,8 +58,9 @@ export const MyIssuesListItem: React.FC<Props> = ({ issue, properties, projectId
|
||||
.then((res) => {
|
||||
mutate(USER_ISSUE(workspaceSlug as string));
|
||||
setToastAlert({
|
||||
type: "info",
|
||||
title: "Issue Updated Successfully",
|
||||
type: "success",
|
||||
title: "Success",
|
||||
message: "Issue updated successfully.",
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -156,7 +156,14 @@ export const IssueDetailsSidebar: React.FC<Props> = ({
|
||||
|
||||
await issuesService
|
||||
.createIssueLink(workspaceSlug as string, projectId as string, issueDetail.id, payload)
|
||||
.then(() => mutate(ISSUE_DETAILS(issueDetail.id)))
|
||||
.then(() => {
|
||||
mutate(ISSUE_DETAILS(issueDetail.id));
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success",
|
||||
message: "Link added successfully",
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.status === 400)
|
||||
setToastAlert({
|
||||
@ -188,9 +195,19 @@ export const IssueDetailsSidebar: React.FC<Props> = ({
|
||||
.deleteIssueLink(workspaceSlug as string, projectId as string, issueDetail.id, linkId)
|
||||
.then((res) => {
|
||||
mutate(ISSUE_DETAILS(issueDetail.id));
|
||||
setToastAlert({
|
||||
title: "Success",
|
||||
message: "Link removed successfully",
|
||||
type: "success",
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: "Something went wrong. Please try again.",
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -7,6 +7,8 @@ import useSWR, { mutate } from "swr";
|
||||
|
||||
// react-hook-form
|
||||
import { useForm } from "react-hook-form";
|
||||
// hooks
|
||||
import useToast from "hooks/use-toast";
|
||||
// services
|
||||
import issuesService from "services/issues.service";
|
||||
// layouts
|
||||
@ -50,6 +52,8 @@ const IssueDetailsPage: NextPage = () => {
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId, issueId } = router.query;
|
||||
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
const { data: issueDetails, mutate: mutateIssueDetails } = useSWR<IIssue | undefined>(
|
||||
workspaceSlug && projectId && issueId ? ISSUE_DETAILS(issueId as string) : null,
|
||||
workspaceSlug && projectId && issueId
|
||||
@ -93,9 +97,19 @@ const IssueDetailsPage: NextPage = () => {
|
||||
.then((res) => {
|
||||
mutateIssueDetails();
|
||||
mutate(PROJECT_ISSUES_ACTIVITY(issueId as string));
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success",
|
||||
message: "Issue updated successfully.",
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: "Something went wrong. Please try again.",
|
||||
});
|
||||
});
|
||||
},
|
||||
[workspaceSlug, issueId, projectId, mutateIssueDetails]
|
||||
|
Loading…
Reference in New Issue
Block a user