diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3ded6fc..cabe1b5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -103,7 +103,18 @@ import { FilterPipeModule } from 'ngx-filter-pipe'; }) export class AppModule { - constructor () { + constructor ( + private api: ApiService, + ) { + this.api.checkDatabaseConnection().subscribe( + result => { + }, + error => { + document.location = '#/500'; + throw new Error('Server connection fail'); + } + ); + if (environment.enableAnalytics) { (window).ga('create', environment.analyticsKey, 'auto'); } diff --git a/src/app/pages/500.component.html b/src/app/pages/500.component.html index e09fae4..79ff5ec 100644 --- a/src/app/pages/500.component.html +++ b/src/app/pages/500.component.html @@ -5,7 +5,7 @@

500

Houston, we have a problem!

-

The page you are looking for is temporarily unavailable.

+

Server connection unavailable.

diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts index dd398e0..59b9e61 100644 --- a/src/app/providers/api-service.ts +++ b/src/app/providers/api-service.ts @@ -41,6 +41,13 @@ export class ApiService { localStorage.removeItem('sessionKey'); } + public checkDatabaseConnection() { + return this.http.post( + this.apiUrl, + null + ); + } + public register(data) { return this.http.post( this.apiUrl + '/register',