Commit d77f79e7 authored by dev0tion's avatar dev0tion

Wait on API to load UI

parent fb5ed9b1
<router-outlet></router-outlet> <div *ngIf="loading">Loading...</div>
\ No newline at end of file <router-outlet *ngIf="!loading"></router-outlet>
...@@ -3,6 +3,9 @@ import { Router } from '@angular/router'; ...@@ -3,6 +3,9 @@ import { Router } from '@angular/router';
import { ApiService } from './shared/services/api.service'; import { ApiService } from './shared/services/api.service';
import 'rxjs/add/operator/retryWhen';
import 'rxjs/add/operator/delay';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
...@@ -13,8 +16,14 @@ export class AppComponent implements OnInit { ...@@ -13,8 +16,14 @@ export class AppComponent implements OnInit {
constructor(private router: Router, private apiService: ApiService) {} constructor(private router: Router, private apiService: ApiService) {}
private errorMessage: any; private errorMessage: any;
private responseMessage: any; private responseMessage: any;
private loading: boolean = true;
ngOnInit() { ngOnInit() {
this.apiService.getWalletFiles().retryWhen(errors => errors.delay(2000)).subscribe(() => this.startApp());
}
startApp() {
this.loading = false;
this.router.navigate(['/login']); this.router.navigate(['/login']);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment