Skip to content
Snippets Groups Projects
Commit d7adf79a authored by Théophile HUSS's avatar Théophile HUSS
Browse files

feat: Add logout button with API route

parent b9f5e930
Branches
1 merge request!49Feature/49 logout
Pipeline #303434 passed with stages
in 50 seconds
<div class="question-marks">
<mat-icon *ngIf="isLogged" (click)="logOut()">logout</mat-icon>
<h1>Your profile</h1>
<div class="content">
<h3>Your stats</h3>
<div class="container">
<div class="grid-profile">
<div class="profile_info">
<img src="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png"
alt="profile picture" />
<img
src="https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png"
alt="profile picture"
/>
<h3>User Name</h3>
</div>
<hr />
<div class="profile_stats">
<img src="https://img.uxcel.com/tags/key-performance-indicator-kpi-1698250709411-2x.jpg"
alt="stats" />
<img
src="https://img.uxcel.com/tags/key-performance-indicator-kpi-1698250709411-2x.jpg"
alt="stats"
/>
</div>
</div>
</div>
<h3>Not logged in</h3>
<div class="grid">
<app-sign *ngIf="!isLogged"></app-sign>
</div>
<app-sign *ngIf="!isLogged"></app-sign>
<div *ngIf="isLogged">
<h3>Your quizzes</h3>
<div class="grid">
<!-- <form [formGroup]="form" (ngSubmit)="submitForm()"> -->
<form>
<div class="form-group">
<input type="text" class="inputRecherche" placeholder="Search a quiz..."
formControlName="quizName" />
<input type="text" class="inputRecherche" placeholder="Search a quiz..." />
</div>
</form>
<div class="container">
......@@ -41,4 +42,4 @@
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
......@@ -37,6 +37,11 @@ export class ProfileInfoComponent implements OnInit {
}
newQuiz() {
this.router.navigate(['/create-custom-quiz']);
this.router.navigate(['/profile/create-custom-quiz']);
}
logOut() {
this.userSerivce.logout().subscribe();
this.router.navigate(['/']);
}
}
......@@ -23,4 +23,8 @@ export class UserService {
public getMe() {
return this.http.get(`${this.apiUrl}/user/me`, { withCredentials: true });
}
public logout() {
return this.http.post(`${this.apiUrl}/auth/logout`, {}, { withCredentials: true });
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment