feat:#4 added link-out button for local import

This commit is contained in:
Elmar Kresse
2024-05-20 14:58:29 +02:00
parent 5641484b93
commit 306ca12391
4 changed files with 27 additions and 3 deletions

View File

@ -76,6 +76,14 @@ const forwardToMicrosoft = () => {
);
};
const forwardToHTWKalendar = () => {
// route to path /calendar/view?token=token
router.push({
name: "calendar-view",
query: { token: tokenStore().token },
});
};
const actions = computed(() => [
{
label: t("calendarLink.copyToClipboard"),
@ -92,6 +100,11 @@ const actions = computed(() => [
icon: "pi pi-microsoft",
command: forwardToMicrosoft,
},
{
label: t("calendarLink.toHTWKalendar"),
icon: "pi pi-home",
command: forwardToHTWKalendar,
}
]);
</script>

View File

@ -139,7 +139,8 @@
"copyToastErrorDetail": "Link konnte nicht in Zwischenablage kopiert werden",
"copyToClipboard": "Link kopieren",
"toGoogleCalendar": "Google Kalender",
"toMicrosoftCalendar": "Microsoft Kalender"
"toMicrosoftCalendar": "Microsoft Kalender",
"toHTWKalendar": "HTWKalender"
},
"calendarPreview": {
"preview": "Vorschau",

View File

@ -139,7 +139,8 @@
"copyToastErrorDetail": "could not copy link to clipboard",
"copyToClipboard": "copy to clipboard",
"toGoogleCalendar": "to Google Calendar",
"toMicrosoftCalendar": "to Microsoft Calendar"
"toMicrosoftCalendar": "to Microsoft Calendar",
"toHTWKalendar": "HTWKalender"
},
"calendarPreview": {
"preview": "preview",

View File

@ -12,7 +12,16 @@ import tokenStore from "@/store/tokenStore.ts";
const { t } = useI18n({ useScope: "global" });
const toast = useToast();
const token = ref("");
const token = ref(tokenStore().token || "" as string );
// parse token from query parameter
const urlParams = new URLSearchParams(window.location.search);
const tokenFromUrl = urlParams.get("token");
if (tokenFromUrl) {
token.value = tokenFromUrl;
tokenStore().setToken(tokenFromUrl);
loadCalendar();
}
function loadCalendar() {
try {