[PE-294] fix : route back on page delete (#6729)
This commit is contained in:
parent
a9045adf17
commit
6157900b23
1 changed files with 9 additions and 0 deletions
|
|
@ -3,12 +3,14 @@
|
|||
import React, { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
// ui
|
||||
import { useParams } from "next/navigation";
|
||||
import { PAGE_DELETED } from "@plane/constants";
|
||||
import { AlertModalCore, TOAST_TYPE, setToast } from "@plane/ui";
|
||||
// constants
|
||||
// hooks
|
||||
import { useEventTracker } from "@/hooks/store";
|
||||
// plane web hooks
|
||||
import { useAppRouter } from "@/hooks/use-app-router";
|
||||
import { EPageStoreType, usePageStore } from "@/plane-web/hooks/store";
|
||||
// store
|
||||
import { TPageInstance } from "@/store/pages/base-page";
|
||||
|
|
@ -36,6 +38,9 @@ export const DeletePageModal: React.FC<TConfirmPageDeletionProps> = observer((pr
|
|||
onClose();
|
||||
};
|
||||
|
||||
const router = useAppRouter();
|
||||
const { pageId: routePageId } = useParams();
|
||||
|
||||
const handleDelete = async () => {
|
||||
setIsDeleting(true);
|
||||
await removePage(pageId)
|
||||
|
|
@ -53,6 +58,10 @@ export const DeletePageModal: React.FC<TConfirmPageDeletionProps> = observer((pr
|
|||
title: "Success!",
|
||||
message: "Page deleted successfully.",
|
||||
});
|
||||
|
||||
if (routePageId) {
|
||||
router.back();
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
capturePageEvent({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue