diff --git a/components/modal/modalComponents/ModalShare.tsx b/components/modal/modalComponents/ModalShare.tsx index 46baeab..eea0580 100644 --- a/components/modal/modalComponents/ModalShare.tsx +++ b/components/modal/modalComponents/ModalShare.tsx @@ -1,7 +1,7 @@ +import { useEffect } from "react"; import { handleCopyUrl } from "@/util/copyUrl"; import { handleShareFacebook, handleShareKakao } from "@/util/shareSNS"; import ModalShareItem from "./ModalShareItem"; -import { useEffect } from "react"; const ModalShare = () => { useEffect(() => { diff --git a/util/shareSNS.ts b/util/shareSNS.ts index f08b1fb..c5922e0 100644 --- a/util/shareSNS.ts +++ b/util/shareSNS.ts @@ -6,16 +6,26 @@ export const handleShareFacebook = () => { export const handleShareKakao = () => { const { Kakao, location } = window; - if (window.Kakao.isInitialized()) { + + // 현재 URL에서 folderId를 추출 + const url = new URL(location.href); + const folderId = url.searchParams.get("folder"); + + // 새로운 URL로 설정 + if (folderId) { + location.href = `https://linkbrary-9-99.vercel.app/share/${folderId}`; + } + + if (Kakao.isInitialized()) { Kakao.Share.sendDefault({ objectType: "feed", content: { title: "나만의 링크 모음", description: "나에게 필요한 링크만 모아 두었어요!", - imageUrl: "https://linkbrary-9-99.vercel.app/images/home_main.png", //배포 후 실제 도메인으로 변경 필요 + imageUrl: "https://linkbrary-9-99.vercel.app/images/home_main.png", // 배포 후 실제 도메인으로 변경 필요 link: { - mobileWebUrl: location.href.replace("link?", "share?"), - webUrl: location.href.replace("link?", "share?"), + mobileWebUrl: location.href, + webUrl: location.href, }, }, });