Skip to content

Commit

Permalink
✨ Feat: 초대 코드 클립보드에 복사하고 공유하기 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wonill committed Dec 9, 2024
1 parent a188c29 commit e1b4f1f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/modals/FamilyDDangModal/ShareCodeModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ export default function ShareCodeModal() {
const { data, refetch } = useInviteCode()

const handleShare = async () => {
navigator.clipboard.writeText(data.inviteCode)
if (navigator.share) {
try {
await navigator.share({
title: '패밀리코드',
text: '텍스트',
url: data.inviteCode,
text: data.inviteCode,
})
} catch (err) {
console.error('Error sharing:', err)
}
} else {
navigator.clipboard.writeText(window.location.href)
alert('Link copied to clipboard!')
}
}

Expand Down

0 comments on commit e1b4f1f

Please sign in to comment.