Reload page after update
This commit is contained in:
		@@ -8,6 +8,9 @@ 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(() => update.activateUpdate()))
 | 
					    update.available.subscribe(() => snackbar.open('Update Available!! 🚀', 'Reload').onAction().subscribe(async () => {
 | 
				
			||||||
 | 
					      await update.activateUpdate();
 | 
				
			||||||
 | 
					      window.location.reload();
 | 
				
			||||||
 | 
					    }))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user