From 914291815c6daa7083bf511fd10b1685ef8f3922 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sat, 24 Aug 2019 19:58:54 -0400 Subject: [PATCH] New way to reload page after update --- src/app/app.component.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 32d6677..138b36d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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()); } }