mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-17 04:42:26 +01:00
added version info and reload option
This commit is contained in:
9
frontend/src/components/AppVersion.vue
Normal file
9
frontend/src/components/AppVersion.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
const version = __APP_VERSION__;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<p>
|
||||
{{ version }}
|
||||
</p>
|
||||
</template>
|
||||
@@ -68,12 +68,7 @@ updateLocale(settingsStore().locale);
|
||||
<template #value="slotProps">
|
||||
<div v-if="slotProps.value" class="flex align-items-center">
|
||||
<div class="mr-2 flag">{{ displayIcon(slotProps.value) }}</div>
|
||||
<div
|
||||
style="
|
||||
font-family: "Twemoji Country Flags",
|
||||
"Helvetica", "Comic Sans", serif;
|
||||
"
|
||||
>
|
||||
<div>
|
||||
{{ displayCountry(slotProps.value) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
39
frontend/src/components/ReloadPwa.vue
Normal file
39
frontend/src/components/ReloadPwa.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script lang="ts" setup>
|
||||
import { useToast } from "primevue/usetoast";
|
||||
|
||||
const Toast = useToast();
|
||||
|
||||
const updateCache = () => {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
registration.unregister().then((boolean) => {
|
||||
if (boolean) {
|
||||
Toast.add({
|
||||
severity: "success",
|
||||
summary: "Service Worker",
|
||||
detail: "Service Worker has been unregistered",
|
||||
life: 1000,
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
Toast.add({
|
||||
severity: "error",
|
||||
summary: "Service Worker",
|
||||
detail: "Service Worker could not be unregistered",
|
||||
life: 1000,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button @click="updateCache()">
|
||||
{{ $t("settings.reloadPwa") }}
|
||||
</Button>
|
||||
</template>
|
||||
Reference in New Issue
Block a user