New way to reload page after update

This commit is contained in:
Zakary Timson 2019-08-24 19:58:54 -04:00
parent 4840601b93
commit 914291815c

View File

@ -8,9 +8,7 @@ import {SwUpdate} from "@angular/service-worker";
})
export class AppComponent {
constructor(private snackbar: MatSnackBar, private update: SwUpdate) {
update.available.subscribe(() => snackbar.open('Update Available!! 🚀', 'Reload').onAction().subscribe(async () => {
await update.activateUpdate();
window.location.reload();
}))
update.available.subscribe(() => snackbar.open('Update Available!! 🚀', 'Reload').onAction().subscribe(async () => update.activateUpdate()))
update.activated.subscribe(() => window.location.reload());
}
}