diff --git a/.env.local b/.env.local index e097257..e1d2d30 100644 --- a/.env.local +++ b/.env.local @@ -6,3 +6,4 @@ ENV=local CONTACT_SERVER=http://localhost:4001 API_CONTACT_SERVER=http://localhost:4001/api/v1 API_INTRANET_SERVER=https://intranet-ext.kric.com/api/v1 +AUTH_COOKIE_DOMAIN= \ No newline at end of file diff --git a/src/app/(pages)/(main)/list/contact/page.tsx b/src/app/(pages)/(main)/list/contact/page.tsx index b62ba82..c33fd72 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, useState } from "react"; +import { Suspense, useEffect, useMemo, useRef, useState } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { ArrowLeft, RefreshCw } from "lucide-react"; import { useMounted } from "@kri/common/hooks"; @@ -37,6 +37,7 @@ const ListContactPageContent = () => { const userRole = auth?.user?.userRole ?? 0; const ctiCallPhase = useCtiCallPhase(); const shouldBlockNavigation = CTI_CALL_PHASE.includes(ctiCallPhase); + const hasObservedCall = useRef(false); const queriesEnabled = mounted && prjctIdx > 0; const enabled = queriesEnabled && !!sid; @@ -74,10 +75,12 @@ const ListContactPageContent = () => { const hasGuardEntry = window.history.state?.[CALL_NAVIGATION_GUARD_KEY] === true; if (!shouldBlockNavigation) { - if (hasGuardEntry) window.history.back(); + if (hasGuardEntry && hasObservedCall.current) window.history.back(); + hasObservedCall.current = false; return; } + hasObservedCall.current = true; let isRestoringHistory = false; if (!hasGuardEntry) { diff --git a/src/lib/cti/ctiClient.ts b/src/lib/cti/ctiClient.ts index 7ac6cca..940012f 100644 --- a/src/lib/cti/ctiClient.ts +++ b/src/lib/cti/ctiClient.ts @@ -756,6 +756,7 @@ const send = (command: Record): boolean => { if (!socket || socket.readyState !== WebSocket.OPEN) return false; try { socket.send(JSON.stringify(command)); + console.log("[CTI][TEMP_LOG] send ->", command); // TEMP_CTI_LOG return true; } catch { return false; @@ -817,7 +818,10 @@ const openSocketAndLogin = (params: CtiLoginParams) => { AgentGroup: CTI_AGENT_GROUP, ANINumber: params.aniNumber, AgentPhone: params.agentPhone }); }; ws.onmessage = (event) => { - if (socket === ws) handleIncomingMessage(event.data); + if (socket === ws) { + console.log("[CTI][TEMP_LOG] message <-", event.data); // TEMP_CTI_LOG + handleIncomingMessage(event.data); + } }; ws.onerror = () => console.warn("[CTI] WebSocket 연결 오류"); ws.onclose = () => {