From 834ce10403baebb472a4108285774c9779a52460 Mon Sep 17 00:00:00 2001 From: sailong Date: Fri, 30 May 2025 16:36:01 +0800 Subject: [PATCH] fix(UI):Fix the redirect logic for reopening and closing MR --- moon/apps/web/pages/[org]/mr/[id].tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/moon/apps/web/pages/[org]/mr/[id].tsx b/moon/apps/web/pages/[org]/mr/[id].tsx index 5bdfbf703..f792dddb9 100644 --- a/moon/apps/web/pages/[org]/mr/[id].tsx +++ b/moon/apps/web/pages/[org]/mr/[id].tsx @@ -24,6 +24,7 @@ import { usePostMrComment } from '@/hooks/usePostMrComment' import { usePostMrMerge } from '@/hooks/usePostMrMerge' import { usePostMrReopen } from '@/hooks/usePostMrReopen'; import { usePostMrClose } from '@/hooks/usePostMrClose'; +import { useScope } from '@/contexts/scope' interface MRDetail { status: string, @@ -41,9 +42,9 @@ export interface Conversation { const MRDetailPage:PageWithLayout = () =>{ const router = useRouter(); const { id : tempId, title } = router.query; - + const { scope } = useScope() const [editorState, setEditorState] = useState(""); - const [login, _setLogin] = useState(false); + const [login, _setLogin] = useState(true); const [outputHtml, setOutputHtml] = useState(''); const id = typeof tempId === 'string' ? tempId : ''; @@ -72,7 +73,7 @@ const MRDetailPage:PageWithLayout = () =>{ const handleMrApprove = () => { approveMr(undefined, { onSuccess: () => { - router.push("/mr") + router.push(`/${scope}/mr`) }, }) } @@ -81,7 +82,7 @@ const MRDetailPage:PageWithLayout = () =>{ const handleMrClose = () => { closeMr(undefined, { onSuccess: () => { - router.push("/mr") + router.push(`/${scope}/mr`) }, }) } @@ -90,7 +91,7 @@ const MRDetailPage:PageWithLayout = () =>{ const handleMrReopen = () => { reopenMr(undefined,{ onSuccess: () => { - router.push("/mr") + router.push(`/${scope}/mr`) }, }) } @@ -167,7 +168,7 @@ const MRDetailPage:PageWithLayout = () =>{ }