Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix auto updates #8

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {useAppStateStore} from '@/stores/appStateStore';
import NavBar from '@/components/NavBar.vue';
import ToastContainer from '@/components/ToastContainer.vue';

const {addToastMessage} = useAppStateStore();

const {t, locale} = useI18n();

const route = useRoute();
Expand All @@ -20,10 +18,14 @@ const {settings} = storeToRefs(useAppStateStore());

const {updateServiceWorker} = useRegisterSW({
immediate: true,
async onNeedRefresh() {
addToastMessage(t('general.updateReady'));
await updateServiceWorker();
window.location.reload();
onRegisteredSW(_, registration) {
registration &&
setInterval(() => {
registration.update();
}, 60 * 1000);
},
onNeedRefresh() {
updateServiceWorker();
},
});

Expand Down
3 changes: 1 addition & 2 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@
"clickToAdd": "Add {0}",
"clickToRemove": "Remove {0}",
"close": "Close",
"start": "Start",
"updateReady": "The app has been updated with latest content."
"start": "Start"
},
"home": {
"info": "Learn more",
Expand Down
3 changes: 1 addition & 2 deletions src/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@
"clickToAdd": "Lisää {0}",
"clickToRemove": "Poista {0}",
"close": "Sulje",
"start": "Aloita",
"updateReady": "Sovellus on päivitetty uuteen versioon."
"start": "Aloita"
},
"home": {
"info": "Lue lisää",
Expand Down