[WEB-4107] chore: redirect user to the newly created project view after creation #7098
This commit is contained in:
parent
037bb88b53
commit
cd200169b6
1 changed files with 5 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ import { EModalPosition, EModalWidth, ModalCore, TOAST_TYPE, setToast } from "@p
|
||||||
import { ProjectViewForm } from "@/components/views";
|
import { ProjectViewForm } from "@/components/views";
|
||||||
// hooks
|
// hooks
|
||||||
import { useProjectView } from "@/hooks/store";
|
import { useProjectView } from "@/hooks/store";
|
||||||
|
import { useAppRouter } from "@/hooks/use-app-router";
|
||||||
import useKeypress from "@/hooks/use-keypress";
|
import useKeypress from "@/hooks/use-keypress";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
@ -23,6 +24,8 @@ type Props = {
|
||||||
|
|
||||||
export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
|
export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
|
||||||
const { data, isOpen, onClose, preLoadedData, workspaceSlug, projectId } = props;
|
const { data, isOpen, onClose, preLoadedData, workspaceSlug, projectId } = props;
|
||||||
|
// router
|
||||||
|
const router = useAppRouter();
|
||||||
// store hooks
|
// store hooks
|
||||||
const { createView, updateView } = useProjectView();
|
const { createView, updateView } = useProjectView();
|
||||||
|
|
||||||
|
|
@ -32,8 +35,9 @@ export const CreateUpdateProjectViewModal: FC<Props> = observer((props) => {
|
||||||
|
|
||||||
const handleCreateView = async (payload: IProjectView) => {
|
const handleCreateView = async (payload: IProjectView) => {
|
||||||
await createView(workspaceSlug, projectId, payload)
|
await createView(workspaceSlug, projectId, payload)
|
||||||
.then(() => {
|
.then((res) => {
|
||||||
handleClose();
|
handleClose();
|
||||||
|
router.push(`/${workspaceSlug}/projects/${projectId}/views/${res.id}`);
|
||||||
setToast({
|
setToast({
|
||||||
type: TOAST_TYPE.SUCCESS,
|
type: TOAST_TYPE.SUCCESS,
|
||||||
title: "Success!",
|
title: "Success!",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue