diff --git a/frontend/src/components/CalendarLink.vue b/frontend/src/components/CalendarLink.vue index 1e955e4..c7ca242 100644 --- a/frontend/src/components/CalendarLink.vue +++ b/frontend/src/components/CalendarLink.vue @@ -84,14 +84,16 @@ const forwardToHTWKalendar = () => { }); }; +const shareData = computed(() => ({ + title: t("calendarLink.shareTitle"), + text: t("calendarLink.shareText") + getLink(), + url: "https://" + domain + "/", +})); + const shareLink = () => { - if (typeof navigator.share === 'function' && navigator.canShare()) { + if (typeof navigator.share === 'function' && navigator.canShare(shareData.value)) { navigator - .share({ - title: t("calendarLink.shareTitle"), - text: t("calendarLink.shareText") + getLink(), - url: "https://" + domain + "/", - }) + .share(shareData.value) .then(() => { toast.add({ severity: "info", @@ -142,7 +144,7 @@ const actions = computed(() => { } ]; - if (typeof navigator.share === 'function' && navigator.canShare()) { + if (typeof navigator.share === 'function' && navigator.canShare(shareData.value)) { actionList.push({ label: t("calendarLink.share"), icon: "pi pi-share-alt", diff --git a/frontend/src/view/UserCalendar.vue b/frontend/src/view/UserCalendar.vue index a41eac3..ee803f8 100644 --- a/frontend/src/view/UserCalendar.vue +++ b/frontend/src/view/UserCalendar.vue @@ -59,12 +59,14 @@ function shareLink() { } const link = "https://" + window.location.hostname + "/calendar/view?token=" + token.value + datePart; - if (typeof navigator.share === "function" && navigator.canShare()) { - navigator.share({ - title: t("calendarLink.shareLinkTitle"), - text: t("calendarLink.shareLinkText"), - url: link, - }); + const shareData = { + title: t("calendarLink.shareLinkTitle"), + text: t("calendarLink.shareLinkText"), + url: link, + }; + + if (typeof navigator.share === "function" && navigator.canShare(shareData)) { + navigator.share(shareData); } else { navigator.clipboard.writeText(link).then(() => { toast.add({