mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-03 18:29:16 +02:00
feat:#60 format, lint and fix build
This commit is contained in:
@@ -4,19 +4,20 @@ import { useToast } from "primevue/usetoast";
|
||||
import { onMounted } from "vue";
|
||||
import router from "../router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n({ useScope: 'global' })
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
const domain = window.location.hostname;
|
||||
|
||||
const getLink = () => "https://" + domain + "/api/feed?token=" + tokenStore().token;
|
||||
const getLink = () =>
|
||||
"https://" + domain + "/api/feed?token=" + tokenStore().token;
|
||||
|
||||
const show = () => {
|
||||
toast.add({
|
||||
severity: "info",
|
||||
summary: t('calendarLink.copyToastSummary'),
|
||||
detail: t('calendarLink.copyToastNotification'),
|
||||
summary: t("calendarLink.copyToastSummary"),
|
||||
detail: t("calendarLink.copyToastNotification"),
|
||||
life: 3000,
|
||||
});
|
||||
};
|
||||
@@ -33,46 +34,48 @@ function rerouteIfTokenIsEmpty() {
|
||||
|
||||
function copyToClipboard() {
|
||||
// Copy the text inside the text field
|
||||
navigator.clipboard.writeText(getLink()).then(
|
||||
show,
|
||||
(err) => {
|
||||
console.error("Could not copy text: ", err);
|
||||
toast.add({
|
||||
severity: "error",
|
||||
summary: t('calendarLink.copyToastError'),
|
||||
detail: t('calendarLink.copyToastErrorDetail'),
|
||||
life: 3000,
|
||||
});
|
||||
},
|
||||
);
|
||||
navigator.clipboard.writeText(getLink()).then(show, (err) => {
|
||||
console.error("Could not copy text: ", err);
|
||||
toast.add({
|
||||
severity: "error",
|
||||
summary: t("calendarLink.copyToastError"),
|
||||
detail: t("calendarLink.copyToastErrorDetail"),
|
||||
life: 3000,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const forwardToGoogle = () => {
|
||||
window.open("https://calendar.google.com/calendar/u/0/r?cid=" + encodeURI(getLink().replace("https://", "http://")));
|
||||
window.open(
|
||||
"https://calendar.google.com/calendar/u/0/r?cid=" +
|
||||
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()));
|
||||
window.open(
|
||||
"https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&name=HTWK%20Kalender&url=" +
|
||||
encodeURI(getLink()),
|
||||
);
|
||||
};
|
||||
|
||||
const actions = [
|
||||
{
|
||||
label: t('calendarLink.copyToClipboard'),
|
||||
label: t("calendarLink.copyToClipboard"),
|
||||
icon: "pi pi-copy",
|
||||
command: copyToClipboard,
|
||||
},
|
||||
{
|
||||
label: t('calendarLink.toGoogleCalendar'),
|
||||
label: t("calendarLink.toGoogleCalendar"),
|
||||
icon: "pi pi-google",
|
||||
command: forwardToGoogle,
|
||||
},
|
||||
{
|
||||
label: t('calendarLink.toMicrosoftCalendar'),
|
||||
label: t("calendarLink.toMicrosoftCalendar"),
|
||||
icon: "pi pi-microsoft",
|
||||
command: forwardToMicrosoft,
|
||||
},
|
||||
];
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
Reference in New Issue
Block a user