Skip to content

Commit

Permalink
Merge pull request #334 from ASAP-as-soon-as-possible/feat/#325/webSh…
Browse files Browse the repository at this point in the history
…areAPI

[ Feat/#325 ] web share api 가능한 환경에서 버튼 text변경
  • Loading branch information
ljh0608 authored Sep 2, 2024
2 parents a876176 + 0d17575 commit 513a079
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/cueCard/CueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ function CueCard() {
});
}
};

useEffect(() => {
const handleBtnText = async () => {
try {
await navigator.share();
const canShare = await navigator.share();
if (canShare !== undefined) {
throw Error;
}
setBtnText('링크 공유하기');
} catch {
setBtnText('링크 복사하기');
}
};

handleBtnText();
});
}, []);

return (
<CueCardWrapper>
Expand Down

0 comments on commit 513a079

Please sign in to comment.