Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from '@angular/core';
- import { Platform } from 'ionic-angular';
- import { StatusBar } from 'ionic-native';
- //import pages
- import { TabsPage } from '../pages/tabs/tabs';
- import { LoginPage } from '../pages/login/login';
- import firebase from 'firebase';
- @Component({
- template: `<ion-nav [root]="rootPage"></ion-nav>`
- })
- export class MyApp {
- public rootPage:any;
- constructor(platform: Platform) {
- // Initialize Firebase
- var config = {
- // i just removed my private details -not to publish
- apiKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- authDomain: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- databaseURL: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- storageBucket: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- messagingSenderId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- };
- firebase.initializeApp(config);
- //check logged in status
- firebase.auth().onAuthStateChanged((user)=>{
- if(user){
- this.rootPage=TabsPage;
- }else{
- this.rootPage=LoginPage;
- }
- });
- platform.ready().then(() => {
- // Okay, so the platform is ready and our plugins are available.
- // Here you can do any higher level native things you might need.
- StatusBar.styleDefault();
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement