New way to reload page after update
This commit is contained in:
parent
4840601b93
commit
914291815c
@ -8,9 +8,7 @@ import {SwUpdate} from "@angular/service-worker";
|
|||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
constructor(private snackbar: MatSnackBar, private update: SwUpdate) {
|
constructor(private snackbar: MatSnackBar, private update: SwUpdate) {
|
||||||
update.available.subscribe(() => snackbar.open('Update Available!! 🚀', 'Reload').onAction().subscribe(async () => {
|
update.available.subscribe(() => snackbar.open('Update Available!! 🚀', 'Reload').onAction().subscribe(async () => update.activateUpdate()))
|
||||||
await update.activateUpdate();
|
update.activated.subscribe(() => window.location.reload());
|
||||||
window.location.reload();
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user