[common/components] feat: 접속 로그 저장 기능 작업

This commit is contained in:
2025-07-31 12:45:01 +09:00
parent 26f222525d
commit 3f85aa676c
4 changed files with 50 additions and 1 deletions
@@ -3,6 +3,7 @@
import { useState, useEffect, useRef } from "react";
import { useQuery } from "@tanstack/react-query";
import { ChevronRight } from "lucide-react";
import { useDetectDevice } from "@frontend-opensource/use-react-hooks";
import { getConfig } from "@common/config";
import { getParentIds } from "./lib";
import {
@@ -24,9 +25,10 @@ import {
import { ENDPOINT } from "../../config";
import { cn, getCookie, setCookie } from "../../lib";
import {
getAnonymouseMenuList,
getMenuList,
getPreviewTreeMenuList,
getAnonymouseMenuList,
saveConnectionLog,
type MenuItem,
} from "../../api";
@@ -55,6 +57,7 @@ export function LNB({
const [defaultOpenMenuIds, setDefaultOpenMenuIds] = useState<number[]>([]);
const [currentMenuCode, setCurrentMenuCode] = useState<number | null>(null);
const prevPathRef = useRef(currentPath);
const { browser } = useDetectDevice();
const siteId = propSiteId ?? appSiteId;
@@ -125,6 +128,16 @@ export function LNB({
}
if (matchedMenuCode) setCurrentMenuCode(matchedMenuCode);
// 접속 로그 저장
saveConnectionLog({
cntnId: userId,
cntnRgn: navigator.language,
wbsrKnd: browser,
menuCd: matchedMenuCode,
siteId,
urlPath: currentPath,
});
}, [menuList, currentPath]);
function MenuItem({