If user already logged in then re-direct navigate on Home page
import { AuthProvider } from '../providers/auth/auth';
import { AngularFireAuth } from 'angularfire2/auth';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = ' ' ;
constructor(public afAuth : AngularFireAuth, public auth : AuthProvider, public platform: Platform, public statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
this.statusBar.backgroundColorByHexString('#024e44');
splashScreen.hide();
});
this.afAuth.authState
.subscribe(
user => {
if (user) {
this.rootPage = TabsPage;
} else {
this.rootPage = LoginPage;
}
},
() => {
this.rootPage = LoginPage;
}
);
}
}
Comments
Post a Comment