Skip to content

Instantly share code, notes, and snippets.

@rogerioadris
Last active June 1, 2020 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerioadris/d2dc59a7e94bc4d31e3773bc257b957f to your computer and use it in GitHub Desktop.
Save rogerioadris/d2dc59a7e94bc4d31e3773bc257b957f to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { NavController, AlertController } from 'ionic-angular';
import { AutenticacaoServiceProvider } from '../../providers/autenticacao-service/autenticacao-service';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(
public navCtrl: NavController,
public authService: AutenticacaoServiceProvider,
public alertCtrl: AlertController) {
// TODO:
}
loginUser() {
this.authService.login();
}
logoutUser() {
this.authService.logout();
}
nextPage() {
this.navCtrl.push('Pagina2Page').catch(err => {
let alert = this.alertCtrl.create({
title: 'Entrada proibida!',
subTitle: 'Você não passará',
buttons: ['Entendi']
});
alert.present();
});
}
isAuthenticated() {
return this.authService.authenticated();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment