mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-22 20:48:48 +02:00
Merge branch '47-wrong-hostname-in-link' into 'main'
Resolve "wrong hostname in link" Closes #47 See merge request htwk-software/htwkalender!51
This commit is contained in:
@ -22,11 +22,11 @@ import { useToast } from "primevue/usetoast";
|
|||||||
import { computed, inject, onMounted } from "vue";
|
import { computed, inject, onMounted } from "vue";
|
||||||
import { router } from "@/main";
|
import { router } from "@/main";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
const { t } = useI18n({ useScope: "global" });
|
const { t } = useI18n({ useScope: "global" });
|
||||||
|
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
const domain = import.meta.env.SSR ? inject<string>("domain")! : window.location.hostname;
|
||||||
const domain = inject<string>("domain")!;
|
|
||||||
|
|
||||||
const getLink = () =>
|
const getLink = () =>
|
||||||
"https://" + domain + "/api/feed?token=" + tokenStore().token;
|
"https://" + domain + "/api/feed?token=" + tokenStore().token;
|
||||||
@ -36,7 +36,7 @@ const show = () => {
|
|||||||
severity: "info",
|
severity: "info",
|
||||||
summary: t("calendarLink.copyToastSummary"),
|
summary: t("calendarLink.copyToastSummary"),
|
||||||
detail: t("calendarLink.copyToastNotification"),
|
detail: t("calendarLink.copyToastNotification"),
|
||||||
life: 3000,
|
life: 3000
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ function copyToClipboard() {
|
|||||||
severity: "error",
|
severity: "error",
|
||||||
summary: t("calendarLink.copyToastError"),
|
summary: t("calendarLink.copyToastError"),
|
||||||
detail: t("calendarLink.copyToastErrorDetail"),
|
detail: t("calendarLink.copyToastErrorDetail"),
|
||||||
life: 3000,
|
life: 3000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -65,14 +65,14 @@ function copyToClipboard() {
|
|||||||
const forwardToGoogle = () => {
|
const forwardToGoogle = () => {
|
||||||
window.open(
|
window.open(
|
||||||
"https://calendar.google.com/calendar/u/0/r?cid=" +
|
"https://calendar.google.com/calendar/u/0/r?cid=" +
|
||||||
encodeURI(getLink().replace("https://", "http://")),
|
encodeURI(getLink().replace("https://", "http://"))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const forwardToMicrosoft = () => {
|
const forwardToMicrosoft = () => {
|
||||||
window.open(
|
window.open(
|
||||||
"https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&name=HTWK%20Kalender&url=" +
|
"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"),
|
label: t("calendarLink.copyToClipboard"),
|
||||||
icon: "pi pi-copy",
|
icon: "pi pi-copy",
|
||||||
command: copyToClipboard,
|
command: copyToClipboard
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("calendarLink.toGoogleCalendar"),
|
label: t("calendarLink.toGoogleCalendar"),
|
||||||
icon: "pi pi-google",
|
icon: "pi pi-google",
|
||||||
command: forwardToGoogle,
|
command: forwardToGoogle
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t("calendarLink.toMicrosoftCalendar"),
|
label: t("calendarLink.toMicrosoftCalendar"),
|
||||||
icon: "pi pi-microsoft",
|
icon: "pi pi-microsoft",
|
||||||
command: forwardToMicrosoft,
|
command: forwardToMicrosoft
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user