From d97015741a0c2f7c9724d05f205806d17b37ddf9 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 28 Jul 2026 08:34:01 +0900 Subject: [PATCH] =?UTF-8?q?260728=5F01=5FENH:=20=ED=86=B5=ED=99=94?= =?UTF-8?q?=EC=A4=91=20=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0,=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=EA=B3=A0=EC=B9=A8(=EB=8B=A8=EC=B6=95=ED=82=A4)=20?= =?UTF-8?q?=EB=A7=89=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(pages)/(main)/list/contact/page.tsx | 32 +++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/app/(pages)/(main)/list/contact/page.tsx b/src/app/(pages)/(main)/list/contact/page.tsx index b5b29c1..7d60b53 100644 --- a/src/app/(pages)/(main)/list/contact/page.tsx +++ b/src/app/(pages)/(main)/list/contact/page.tsx @@ -1,6 +1,6 @@ 'use client' -import { Suspense, useEffect, useMemo, useRef, useState } from "react"; +import { Suspense, useEffect, useMemo, useState } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { ArrowLeft, CalendarClock, RefreshCw } from "lucide-react"; import { useMounted } from "@kri/common/hooks"; @@ -40,7 +40,6 @@ const ListContactPageContent = () => { const userRole = auth?.user?.userRole ?? 0; const ctiCallPhase = useCtiCallPhase(); const shouldBlockNavigation = CTI_CALL_PHASE.includes(ctiCallPhase); - const allowPageExitRef = useRef(false); const queriesEnabled = mounted && prjctIdx > 0; const enabled = queriesEnabled && !!sid; @@ -49,13 +48,29 @@ const ListContactPageContent = () => { if (!shouldBlockNavigation) return; const handleBeforeUnload = (event: BeforeUnloadEvent) => { - if (allowPageExitRef.current) return; event.preventDefault(); + + //구형 브라우저를 커버하기 위함 event.returnValue = true; }; + const handleReloadShortcut = (event: KeyboardEvent) => { + const isReloadShortcut = + event.key === "F5" || + ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "r"); + + if (!isReloadShortcut) return; + + event.preventDefault(); + if (!event.repeat) alert("통화 중에는 새로고침할 수 없습니다."); + }; + window.addEventListener("beforeunload", handleBeforeUnload); - return () => window.removeEventListener("beforeunload", handleBeforeUnload); + window.addEventListener("keydown", handleReloadShortcut, true); + return () => { + window.removeEventListener("beforeunload", handleBeforeUnload); + window.removeEventListener("keydown", handleReloadShortcut, true); + }; }, [shouldBlockNavigation]); useEffect(() => { @@ -85,12 +100,7 @@ const ListContactPageContent = () => { return; } - const shouldLeave = window.confirm("통화 중입니다. 현재 페이지를 떠나시겠습니까?"); - if (shouldLeave) { - allowPageExitRef.current = true; - window.history.back(); - return; - } + alert("통화 중에는 페이지를 이동할 수 없습니다."); isRestoringHistory = true; window.history.forward(); @@ -126,7 +136,7 @@ const ListContactPageContent = () => { useEffect(() => { if (sid) return; alert("sid가 없으면 진행할 수 없습니다."); - router.back(); + router.push("/list/manage"); }, [sid, router]); const handleNavigateToSid = (nextSid: string) => { -- 2.49.0.windows.1