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, Splashscreen } from 'ionic-native';
- import { TabsPage } from '../pages/tabs/tabs';
- import { LoginPage } from '..pages/login/login';
- import { PostsPage } from '..pages/posts/posts';
- import { firebase } from 'firebase';
- @Component({
- templateUrl: 'app.html'
- })
- export class MyApp {
- rootPage = TabsPage;
- constructor(platform: Platform) {
- // Initialize Firebase
- var config = {
- apiKey: "AIzaSyCbEnZJcfxDusJFbTOA3dPr5AdRuDPH4wY",
- authDomain: "ebonny-bb8e3.firebaseapp.com",
- databaseURL: "https://ebonny-bb8e3.firebaseio.com",
- storageBucket: "ebonny-bb8e3.appspot.com",
- messagingSenderId: "439414416206"
- };
- firebase.initializeApp(config);
- firebase.auth().OnAuthStateChanged(user) => {
- if(user) {
- this.rootPage = PostsPage
- }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();
- Splashscreen.hide();
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement