mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 09:38:51 +02:00
fix:#47 added ssr check
This commit is contained in:
@ -19,14 +19,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script lang="ts" setup>
|
||||
import tokenStore from "@/store/tokenStore.ts";
|
||||
import { useToast } from "primevue/usetoast";
|
||||
import { computed, onMounted } from "vue";
|
||||
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 = window.location.hostname;
|
||||
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>
|
||||
|
||||
|
Reference in New Issue
Block a user