repare login

add search in sale detail
add refresh button in sale detail
This commit is contained in:
2024-11-26 15:10:38 +01:00
parent 848fc4909e
commit 23dbfff014
41 changed files with 192 additions and 127 deletions
@@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { tap, catchError } from 'rxjs/operators';
import { of } from 'rxjs';
import { Router } from '@angular/router';
import { UntypedFormControl, Validators, UntypedFormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser';
@@ -15,7 +17,8 @@ export class LoginComponent implements OnInit {
loginForm!: UntypedFormGroup;
loading!: boolean;
constructor(private router: Router,
constructor(
private router: Router,
private titleService: Title,
private notificationService: NotificationService,
private authenticationService: AuthenticationService) {
@@ -45,23 +48,26 @@ export class LoginComponent implements OnInit {
this.loading = true;
this.authenticationService
.login(email.toLowerCase(), password)
.subscribe(
data => {
if (rememberMe) {
localStorage.setItem('savedUserEmail', email);
} else {
localStorage.removeItem('savedUserEmail');
}
this.router.navigate(['dashboard']);
},
error => {
this.notificationService.openSnackBar(error.error.message);
this.loading = false;
}
);
.pipe(
tap(data => {
if (rememberMe) {
localStorage.setItem('savedUserEmail', email);
} else {
localStorage.removeItem('savedUserEmail');
}
setTimeout(() => {
this.router.navigate(['sales'])
},100);
}),
catchError(error => {
this.notificationService.openSnackBar(error.error.message);
this.loading = false;
return of(null); // Return an observable to complete the stream
})
)
.subscribe();
}
resetPassword() {
this.router.navigate(['/auth/password-reset-request']);
}