Close toast on click
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ usePWAReload();
|
|||||||
<template #top>
|
<template #top>
|
||||||
<VaNavbar shadowed>
|
<VaNavbar shadowed>
|
||||||
<template #center>
|
<template #center>
|
||||||
<RouterLink to="/" class="text-2xl font-bold hover:underline">TramTracks</RouterLink>
|
<RouterLink to="/" class="text-2xl font-bold hover:underline">TramTrack</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
<VaButton to="/stats" icon="leaderboard" title="Statistiken" />
|
<VaButton to="/stats" icon="leaderboard" title="Statistiken" />
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useRegisterSW } from 'virtual:pwa-register/vue';
|
|||||||
import { useToast } from 'vuestic-ui';
|
import { useToast } from 'vuestic-ui';
|
||||||
|
|
||||||
export function usePWAReload() {
|
export function usePWAReload() {
|
||||||
const { init } = useToast();
|
const { init, close } = useToast();
|
||||||
|
|
||||||
const { updateServiceWorker } = useRegisterSW({
|
const { updateServiceWorker } = useRegisterSW({
|
||||||
immediate: true,
|
immediate: true,
|
||||||
@@ -24,14 +24,21 @@ export function usePWAReload() {
|
|||||||
color: 'success',
|
color: 'success',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
}),
|
}),
|
||||||
onNeedRefresh: () =>
|
onNeedRefresh: () => {
|
||||||
init({
|
const toastId = init({
|
||||||
title: 'Update verfügbar',
|
title: 'Update verfügbar',
|
||||||
message: 'Für diese WebApp ist ein Update verfügbar, bitte klicke hier zum Aktualisieren!',
|
message: 'Für diese WebApp ist ein Update verfügbar, bitte klicke hier zum Aktualisieren!',
|
||||||
color: 'warning',
|
color: 'warning',
|
||||||
duration: 0,
|
duration: 0,
|
||||||
closeable: false,
|
closeable: false,
|
||||||
onClick: updateServiceWorker
|
onClick: async () => {
|
||||||
})
|
await updateServiceWorker();
|
||||||
|
|
||||||
|
if (toastId) {
|
||||||
|
close(toastId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user