import { Component, OnInit } from '@angular/core'; import { Location } from '@angular/common'; @Component({ selector: 'app-welcome', templateUrl: './welcome.page.html', styleUrls: ['./welcome.page.scss'], }) export class WelcomePage implements OnInit { user: any; constructor( private location: Location ) { } ngOnInit() { if (localStorage.getItem('FBUser')) { this.user = JSON.parse(localStorage.getItem('FBUser')); setTimeout(() => { this.location.back(); setTimeout(() => { location.reload(); }, 200); }, 3000); } else { this.user = null; this.location.back(); } } }