This commit is contained in:
Lynn
2022-01-18 17:09:12 +01:00
parent 8df7a8da6f
commit ca7f46667d
3 changed files with 15 additions and 4 deletions

View File

@@ -234,8 +234,19 @@ function Game(props: GameProps) {
<p>
<button
onClick={() => {
navigator.clipboard.writeText(getChallengeUrl(target));
setHint("Challenge link copied to clipboard!");
const url = getChallengeUrl(target);
if (!navigator.clipboard) {
setHint(url);
} else {
navigator.clipboard
.writeText(url)
.then(() => {
setHint("Challenge link copied to clipboard!");
})
.catch(() => {
setHint(url);
});
}
}}
>
Challenge a friend to this word