Skip to content

Commit 0204115

Browse files
authored
Fix: shardSNS location.href 수정
Fix: shardSNS location.href 수정
2 parents 2fd1f93 + cff6580 commit 0204115

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

components/modal/modalComponents/ModalShare.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { useEffect } from "react";
12
import { handleCopyUrl } from "@/util/copyUrl";
23
import { handleShareFacebook, handleShareKakao } from "@/util/shareSNS";
34
import ModalShareItem from "./ModalShareItem";
4-
import { useEffect } from "react";
55

66
const ModalShare = () => {
77
useEffect(() => {

util/shareSNS.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,26 @@ export const handleShareFacebook = () => {
66

77
export const handleShareKakao = () => {
88
const { Kakao, location } = window;
9-
if (window.Kakao.isInitialized()) {
9+
10+
// 현재 URL에서 folderId를 추출
11+
const url = new URL(location.href);
12+
const folderId = url.searchParams.get("folder");
13+
14+
// 새로운 URL로 설정
15+
if (folderId) {
16+
location.href = `https://linkbrary-9-99.vercel.app/share/${folderId}`;
17+
}
18+
19+
if (Kakao.isInitialized()) {
1020
Kakao.Share.sendDefault({
1121
objectType: "feed",
1222
content: {
1323
title: "나만의 링크 모음",
1424
description: "나에게 필요한 링크만 모아 두었어요!",
15-
imageUrl: "https://linkbrary-9-99.vercel.app/images/home_main.png", //배포 후 실제 도메인으로 변경 필요
25+
imageUrl: "https://linkbrary-9-99.vercel.app/images/home_main.png", // 배포 후 실제 도메인으로 변경 필요
1626
link: {
17-
mobileWebUrl: location.href.replace("link?", "share?"),
18-
webUrl: location.href.replace("link?", "share?"),
27+
mobileWebUrl: location.href,
28+
webUrl: location.href,
1929
},
2030
},
2131
});

0 commit comments

Comments
 (0)