mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-29 10:32:15 +00:00
21 lines
586 B
TypeScript
21 lines
586 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
import { SwUpdate } from '@angular/service-worker';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class UpdateService {
|
|
constructor(private swUpdate: SwUpdate, snackbar: MatSnackBar) {
|
|
this.swUpdate.checkForUpdate();
|
|
|
|
this.swUpdate.available.subscribe((evt) => {
|
|
const snack = snackbar.open('Update Available', 'Reload');
|
|
|
|
snack.onAction().subscribe(() => {
|
|
window.location.reload();
|
|
});
|
|
});
|
|
}
|
|
}
|