fix WebShare API permissions by checking the URL to share

This commit is contained in:
survellow
2024-09-23 19:03:24 +02:00
parent f40ec4fc36
commit 3ed25a412f
2 changed files with 17 additions and 13 deletions

View File

@@ -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",