Skip to content

Commit

Permalink
Merge pull request #6 from YerangPark/dev
Browse files Browse the repository at this point in the history
fix: 내보내기 버튼 미동작 문제 해결
  • Loading branch information
YerangPark authored Oct 17, 2024
2 parents cf90e44 + fc5f11c commit 1831747
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/components/templates/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,22 @@ const DashboardPage: React.FC = () => {
handleExport={(portfolioId) => {
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'http://yrpark.duckdns.org'
const publicUrl = `${baseUrl}/${username}/${portfolioId}`
navigator.clipboard
.writeText(publicUrl)
.then(() => {
setNotificationMessage('내보내기 링크가 복사되었습니다.')
setShowNotification(true)
})
.catch((err) => {
console.error('링크 복사 중 오류가 발생했습니다:', err)
setNotificationMessage('링크 복사 중 오류가 발생했습니다.')
setShowNotification(true)
})

const tempInput = document.createElement('input')
tempInput.value = publicUrl
document.body.appendChild(tempInput)
tempInput.select()

try {
document.execCommand('copy')
setNotificationMessage('내보내기 링크가 복사되었습니다.')
} catch (err) {
console.error('링크 복사 중 오류가 발생했습니다:', err)
setNotificationMessage('링크 복사 중 오류가 발생했습니다.')
}

document.body.removeChild(tempInput)
setShowNotification(true)
}}
/>
) : (
Expand Down

0 comments on commit 1831747

Please sign in to comment.