added interceptor and authService to manage log
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
</p>
|
||||
|
||||
@if (authState()) {
|
||||
<app-sign-in-form class="mb-9"></app-sign-in-form>
|
||||
<app-sign-in-form class="mb-9" #loginForm></app-sign-in-form>
|
||||
|
||||
<ion-button class="w-10/12 mt-0 border-0" color="primary">
|
||||
<ion-button class="w-10/12 mt-0 border-0" color="primary" (click)="connectUser()">
|
||||
<p class="text-white font-bold m-0">Se connecter</p>
|
||||
</ion-button>
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import {Component, signal} from '@angular/core';
|
||||
import {Component, inject, signal, viewChild} from '@angular/core';
|
||||
import {IonicModule} from "@ionic/angular";
|
||||
import {SignInFormComponent} from "../../components/sign-in-form/sign-in-form.component";
|
||||
import {SignOnFormComponent} from "../../components/sign-on-form/sign-on-form.component";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {AuthManageService} from "../../services/auth-manage";
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@@ -15,13 +17,21 @@ import {SignOnFormComponent} from "../../components/sign-on-form/sign-on-form.co
|
||||
})
|
||||
export class LoginComponent {
|
||||
authState = signal<boolean>(true)
|
||||
login = viewChild<SignInFormComponent>('loginForm');
|
||||
|
||||
createAccount(): void {
|
||||
private authManageService = inject(AuthManageService);
|
||||
|
||||
createAccount() {
|
||||
if (this.authState()) {
|
||||
this.authState.set(false);
|
||||
}else
|
||||
if (this.authState() == false) {
|
||||
} else if (this.authState() == false) {
|
||||
this.authState.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
connectUser() {
|
||||
const user = this.login().loginForm.getRawValue();
|
||||
console.log(user);
|
||||
this.authManageService.connectUser(user.username, user.password);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user