fix: 공통으로 공유하기 사용하도록 변경
This commit is contained in:
1 parent
3566c1f7bc
commit
e400884eb7
7 files changed
+6
-30
No files matched your search
@@ -103,11 +103,9 @@ const VideoDetailContent: React.FC<VideoDetailContentProps> = ({ videoId, isModa
|
||||
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(date.getDate()).padStart(2, '0')}`;
|
||||
};
|
||||
|
||||
const videoPageUrl = `${window.location.origin}/video/${videoId}`;
|
||||
const shareUrl = buildVideoShareUrl(API_URL, videoId);
|
||||
const shareTitle = video?.store_name ?? t('videoDetail.kakaoDefaultTitle');
|
||||
const shareDescription = t('videoDetail.kakaoDescription', { region: video?.region ?? '' });
|
||||
const shareImageUrl = video?.poster_url || `${window.location.origin}/assets/images/hero-background.png`;
|
||||
|
||||
const handleCopyLink = async () => {
|
||||
try {
|
||||
@@ -122,16 +120,9 @@ const VideoDetailContent: React.FC<VideoDetailContentProps> = ({ videoId, isModa
|
||||
const handleKakaoShare = () => {
|
||||
const kakao = window.Kakao;
|
||||
if (kakao?.Share) {
|
||||
kakao.Share.sendDefault({
|
||||
objectType: 'feed',
|
||||
content: {
|
||||
title: shareTitle,
|
||||
description: shareDescription,
|
||||
imageUrl: shareImageUrl,
|
||||
link: { mobileWebUrl: videoPageUrl, webUrl: videoPageUrl },
|
||||
},
|
||||
buttons: [{ title: t('videoDetail.kakaoButtonTitle'), link: { mobileWebUrl: videoPageUrl, webUrl: videoPageUrl } }],
|
||||
});
|
||||
// 공유 URL(백엔드 OG 페이지)을 스크랩해 제목/설명/이미지를 자동으로 채운다.
|
||||
// 다른 채널과 동일한 shareUrl을 쓰므로 카카오만을 위한 별도 콘텐츠 지정이 필요 없다.
|
||||
kakao.Share.sendScrap({ requestUrl: shareUrl });
|
||||
} else if (navigator.share) {
|
||||
navigator.share({ title: shareTitle, text: shareDescription, url: shareUrl }).catch(() => {});
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user