Merge branch '47-wrong-hostname-in-link' into 'development'

Resolve "wrong hostname in link"

See merge request htwk-software/htwkalender!52
This commit is contained in:
Elmar Kresse
2024-07-06 17:20:31 +00:00

View File

@ -22,11 +22,11 @@ import { useToast } from "primevue/usetoast";
import { computed, inject, onMounted } from "vue";
import { router } from "@/main";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });
const toast = useToast();
const domain = inject<string>("domain")!;
const domain = import.meta.env.SSR ? inject<string>("domain")! : window.location.hostname;
const getLink = () =>
"https://" + domain + "/api/feed?token=" + tokenStore().token;
@ -36,7 +36,7 @@ const show = () => {
severity: "info",
summary: t("calendarLink.copyToastSummary"),
detail: t("calendarLink.copyToastNotification"),
life: 3000,
life: 3000
});
};
@ -57,7 +57,7 @@ function copyToClipboard() {
severity: "error",
summary: t("calendarLink.copyToastError"),
detail: t("calendarLink.copyToastErrorDetail"),
life: 3000,
life: 3000
});
});
}
@ -65,14 +65,14 @@ function copyToClipboard() {
const forwardToGoogle = () => {
window.open(
"https://calendar.google.com/calendar/u/0/r?cid=" +
encodeURI(getLink().replace("https://", "http://")),
encodeURI(getLink().replace("https://", "http://"))
);
};
const forwardToMicrosoft = () => {
window.open(
"https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&name=HTWK%20Kalender&url=" +
encodeURI(getLink()),
encodeURI(getLink())
);
};
@ -80,18 +80,18 @@ const actions = computed(() => [
{
label: t("calendarLink.copyToClipboard"),
icon: "pi pi-copy",
command: copyToClipboard,
command: copyToClipboard
},
{
label: t("calendarLink.toGoogleCalendar"),
icon: "pi pi-google",
command: forwardToGoogle,
command: forwardToGoogle
},
{
label: t("calendarLink.toMicrosoftCalendar"),
icon: "pi pi-microsoft",
command: forwardToMicrosoft,
},
command: forwardToMicrosoft
}
]);
</script>