diff --git a/frontend/src/view/CalendarLink.vue b/frontend/src/view/CalendarLink.vue index 500f829..8cf7206 100644 --- a/frontend/src/view/CalendarLink.vue +++ b/frontend/src/view/CalendarLink.vue @@ -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("domain")!; +const domain = import.meta.env.SSR ? inject("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 + } ]);