You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/app/home/home.page.ts

30 lines
735 B

import {Component, OnInit} from '@angular/core';
import {ApiService} from '../service/api.service';
import {isDebug, debug} from '../utility';
import {Router} from '@angular/router';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
constructor(
public readonly api: ApiService,
public readonly router: Router,
) {}
ionViewDidEnter() {
if ( !this.api.isAuthenticated || this.api.isPublicUser ) {
if ( isDebug() ) {
debug('Forcing authentication...');
setTimeout(() => {
this.router.navigate(['/login']);
}, 2000);
} else {
this.router.navigate(['/login']);
}
}
}
}