This commit is contained in:
tiago.kayaya
2021-02-24 17:23:35 +01:00
parent 5b0e22e427
commit 6ba294d169
2 changed files with 29 additions and 30 deletions
+21 -3
View File
@@ -12,6 +12,7 @@ import { NotificationsService } from 'src/app/services/notifications.service';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Token } from '../../models/token.model';
import { AlertService } from 'src/app/services/alert.service';
import { Storage } from '@ionic/storage';
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core';
@@ -40,7 +41,8 @@ export class LoginPage implements OnInit {
private toastService: ToastService,
private photoService: PhotoService,
public alertController: AlertController,
private alertService: AlertService,) { }
private alertService: AlertService,
private storage: Storage,) { }
ngOnInit() {
@@ -125,7 +127,23 @@ export class LoginPage implements OnInit {
domainName: environment.domain,
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)) {
await this.authService.login(this.userattempt);
this.storage.get('login').then((login)=>{
if (login) {
this.alertService.presentAlert('5');
this.loginRocketChat();
//this.storeUserIdANdToken();
this.router.navigate(['/home/events']);
}
else {
//this.toastService.presentToast('Não foi possível fazer login"');
this.presentAlert('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar.');
}
});
/* if (await this.authService.login(this.userattempt)) {
this.alertService.presentAlert('5');
this.loginRocketChat();
//this.storeUserIdANdToken();
@@ -135,7 +153,7 @@ export class LoginPage implements OnInit {
else {
//this.toastService.presentToast('Não foi possível fazer login"');
this.presentAlert('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar.');
}
} */
}
else {
//this.toastService.presentToast('Preencha todos campos');