This repository was archived by the owner on Nov 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +17
-5
lines changed
Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ <h2 class="mt-6 text-3xl font-semibold text-slate-900">Connectez-vous</h2>
66 </ p >
77</ div >
88
9+ <!-- Validation Errors -->
10+ < cosna-errors *ngIf ="error$ | async; let error " [message] ="error " class ="mt-4 "> </ cosna-errors >
11+
912< form [formGroup] ="form " (submit) ="submit() " class ="mt-10 space-y-6 ">
1013 <!-- Email Address -->
1114 < div >
@@ -38,8 +41,8 @@ <h2 class="mt-6 text-3xl font-semibold text-slate-900">Connectez-vous</h2>
3841 </ div >
3942
4043 < div >
41- < cosna-button-primary type ="submit " class ="relative justify-center w-full group ">
42- < span class ="absolute inset-y-0 left-0 flex items-center pl-3 ">
44+ < cosna-button-primary type ="submit " class ="relative justify-center w-full group disabled:opacity-50 disabled:cursor-not-allowed " [loading$] =" (loading$) ">
45+ < span *ngIf =" !(loading$ | async) " class ="absolute inset-y-0 left-0 flex items-center pl-3 ">
4346 < svg class ="w-5 h-5 text-primary-500 group-hover:text-primary-400 " viewBox ="0 0 20 20 " fill ="currentColor " xmlns ="http://www.w3.org/2000/svg ">
4447 < path fill-rule ="evenodd " clip-rule ="evenodd " d ="M10 1C7.51472 1 5.5 3.01472 5.5 5.5V9H5C3.89543 9 3 9.89543 3 11V17C3 18.1046 3.89543 19 5 19H15C16.1046 19 17 18.1046 17 17V11C17 9.89543 16.1046 9 15 9H14.5V5.5C14.5 3.01472 12.4853 1 10 1ZM13 9V5.5C13 3.84315 11.6569 2.5 10 2.5C8.34315 2.5 7 3.84315 7 5.5V9H13Z " />
4548 </ svg >
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Store } from '@ngrx/store';
44import { Observable } from 'rxjs' ;
55
66import { authenticateAction } from '../../store/auth.actions' ;
7- import { selectError } from '../../store/auth.selectors' ;
7+ import { selectError , selectLoading } from '../../store/auth.selectors' ;
88
99@Component ( {
1010 templateUrl : './login.component.html' ,
@@ -15,14 +15,14 @@ export class LoginComponent implements OnInit {
1515 password : [ '' , Validators . required ] ,
1616 } ) ;
1717 public error$ : Observable < string | null > = this . store . select ( selectError ) ;
18+ public loading$ : Observable < boolean > = this . store . select ( selectLoading ) ;
1819
1920 constructor ( private formBuilder : FormBuilder , private store : Store ) { }
2021
2122 ngOnInit ( ) : void { }
2223
2324 public submit ( ) {
2425 if ( this . form . valid ) {
25- // console.log(this.form.getRawValue());
2626 this . store . dispatch ( authenticateAction ( { credentials : this . form . getRawValue ( ) } ) ) ;
2727 }
2828 }
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export class AuthEffects {
2424 catchError ( ( error ) => {
2525 return of (
2626 AuthActions . authenticateFailureAction ( {
27- error : error ?. message ?? 'Unknown error occurred' ,
27+ error : error . error ?. message ?? 'Unknown error occurred' ,
2828 } )
2929 )
3030 } )
Original file line number Diff line number Diff line change 1+ export interface AuthResponse {
2+ user : User ;
3+ access_token : string ;
4+ token_type : string ;
5+ expires_at : Date ;
6+ }
7+
18export interface User {
29 id : number ;
310 name : string ;
Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ import { ThemeModule } from './themes/theme.module';
66
77import { OverlapingLabelComponent } from './components/inputs/overlaping-label/overlaping-label.component' ;
88import { PrimaryComponent as ButtonPrimary } from './components/buttons/primary/primary.component' ;
9+ import { ErrorComponent } from './components/error/error.component' ;
910
1011
1112const MODULES = [ CommonModule , ThemeModule ] ;
1213const DECLARATIONS = [
1314 ButtonPrimary ,
1415 OverlapingLabelComponent ,
16+ ErrorComponent ,
1517] ;
1618
1719@NgModule ( {
You can’t perform that action at this time.
0 commit comments