Created
November 7, 2017 23:44
-
-
Save gustavopinho/d833e405220c1e2d878deba8915a723b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| import { NavController } from 'ionic-angular'; | |
| // Páginas que serão usadas para redirecionamento | |
| import { HomePage } from '../home/home'; | |
| import { LoginPage } from '../login/login'; | |
| import { TarefasFinalizadasPage } from '../tarefas-finalizadas/tarefas-finalizadas'; | |
| // Serviço de autenticação | |
| import { AuthProvider } from '../../providers/auth/auth' | |
| @Component({ | |
| templateUrl: 'tabs.html' | |
| }) | |
| export class TabsPage { | |
| // Paginas que teremos no tabs | |
| tab1Root = HomePage; | |
| tab2Root = TarefasFinalizadasPage; | |
| constructor(public navCtrl: NavController, private auth: AuthProvider) { | |
| // Usado para direcionar o usuário que não estiver logado para a página de login | |
| this.auth.user.subscribe( | |
| (auth) => { | |
| if (auth == null) { | |
| this.navCtrl.setRoot(LoginPage); | |
| } | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment