This commit is contained in:
@@ -28,7 +28,7 @@ import {scan, withLatestFrom} from 'rxjs/operators';
|
||||
export class AppComponent implements OnInit, OnDestroy {
|
||||
|
||||
loading = true;
|
||||
offline = !navigator.onLine;
|
||||
offline = false;
|
||||
private subscriptions: Subscription[] = [];
|
||||
private subscriptionsInitialized = false;
|
||||
|
||||
@@ -61,9 +61,17 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
|
||||
private onOffline = () => {
|
||||
this.offline = true;
|
||||
this.checkServerReachable().then(reachable => {
|
||||
this.offline = !reachable;
|
||||
});
|
||||
};
|
||||
|
||||
private checkServerReachable(): Promise<boolean> {
|
||||
return fetch('/api/public/settings', {method: 'HEAD', cache: 'no-store'})
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
reload(): void {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user