Skip to content

Commit

Permalink
Merge pull request #74 from dnd-side-project/develop
Browse files Browse the repository at this point in the history
✨ v1.0.4
  • Loading branch information
seondal authored Jun 11, 2024
2 parents 934b02d + 63739fe commit 1955363
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/app/(Sub)/detail/[id]/DetailSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function DetailSection({ poseId }: DetailSectionProps) {
type="secondary"
className="border border-border-default"
/>
<PrimaryButton text="카카오 공유" onClick={() => shareKakao(BASE_SITE_URL + pathname)} />
<PrimaryButton text="카카오 공유" onClick={() => shareKakao(poseId)} />
</BottomFixedDiv>
</div>
);
Expand Down
24 changes: 5 additions & 19 deletions src/hooks/useKakaoShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { useEffect } from 'react';

import { KAKAO_JS_KEY } from '@/constants/env';
import { OPEN_GRAPH } from '@/constants/meta';

export default function useKakaoShare() {
useEffect(() => {
Expand All @@ -16,31 +15,18 @@ export default function useKakaoShare() {
};
}, []);

const shareKakao = (uri: string) => {
const shareKakao = (poseId: number) => {
if (window.Kakao) {
const kakao = window.Kakao;
if (!kakao.isInitialized()) {
kakao.init(KAKAO_JS_KEY);
}

kakao.Link.sendDefault({
objectType: 'feed',
content: {
...OPEN_GRAPH.kakao_share,
link: {
mobileWebUrl: uri,
webUrl: uri,
},
kakao.Share.sendCustom({
templateId: 108921,
templateArgs: {
poseId,
},
buttons: [
{
title: '포즈 확인하기',
link: {
mobileWebUrl: uri,
webUrl: uri,
},
},
],
});
}
};
Expand Down

0 comments on commit 1955363

Please sign in to comment.