Add logout

This commit is contained in:
Peter Maquiran
2021-05-28 16:24:37 +01:00
parent 5267caaf80
commit a4e3d431fa
2 changed files with 30 additions and 16 deletions
@@ -1,5 +1,3 @@
<ion-content class=" bg-blue"> <ion-content class=" bg-blue">
<div class="profile-content"> <div class="profile-content">
@@ -55,7 +53,17 @@
<ion-footer class=" footer-container ion-no-border bg-blue"> <ion-footer class=" footer-container ion-no-border bg-blue">
<div class="d-flex justify-center mb-10">
<ion-buttons slot="start" (click)="logout()">
<ion-button class="btn-cancel" fill="clear"style="background:#ffe0e0;" >
<ion-label style="color:#d30a0a;">Terminar sessão</ion-label>
</ion-button>
</ion-buttons>
</div>
<div class="d-flex justify-space-between"> <div class="d-flex justify-space-between">
<ion-buttons slot="start" (click)="close()"> <ion-buttons slot="start" (click)="close()">
<ion-button class="btn-cancel" fill="clear" color="#061b52" > <ion-button class="btn-cancel" fill="clear" color="#061b52" >
<ion-label>Cancelar</ion-label> <ion-label>Cancelar</ion-label>
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AnimationController, ModalController } from '@ionic/angular'; import { AnimationController, ModalController } from '@ionic/angular';
import { User } from 'src/app/models/user.model'; import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
@@ -16,7 +17,8 @@ export class ProfileComponent implements OnInit {
constructor(private modalController:ModalController, constructor(private modalController:ModalController,
private authService: AuthService, private authService: AuthService,
private animationController: AnimationController) { private animationController: AnimationController,
private router: Router) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
@@ -104,5 +106,9 @@ export class ProfileComponent implements OnInit {
modal.present(); modal.present();
} }
logout() {
this.router.navigate(['/']);
}
} }