Convert observables to signals.

This commit is contained in:
Florian THIERRY
2026-02-03 11:00:29 +01:00
parent a2de24fd93
commit c91bb7b720
100 changed files with 2998 additions and 3065 deletions

View File

@@ -1,12 +1,12 @@
import { Injectable, inject } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { copy } from '../../core/utils/ObjectUtils';
import { FormError } from '../../core/model/FormError';
import { UserRestService } from '../../core/rest-services/user/user.rest-service';
import { LoginRequest } from '../../core/rest-services/user/model/login.model';
import { AuthenticationService } from '../../core/service/authentication.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router';
import {inject, Injectable} from '@angular/core';
import {BehaviorSubject, Observable} from 'rxjs';
import {copy} from '../../core/utils/ObjectUtils';
import {FormError} from '../../core/model/FormError';
import {UserRestService} from '../../core/rest-services/user/user.rest-service';
import {LoginRequest} from '../../core/rest-services/user/model/login.model';
import {AuthenticationService} from '../../core/service/authentication.service';
import {MatSnackBar} from '@angular/material/snack-bar';
import {Router} from '@angular/router';
export interface LoginState {
request: LoginRequest;
@@ -65,15 +65,15 @@ export class LoginService {
.login(state.request)
.then((response) => {
this.authenticationService.authenticate(response.accessToken, response.refreshToken);
this.snackBar.open($localize`Authentication succeeded!`, $localize`Close`, { duration: 5000 });
this.snackBar.open($localize`Authentication succeeded!`, $localize`Close`, {duration: 5000});
this.router.navigate(['/home']);
})
.catch((error) => {
console.error(error);
this.snackBar.open($localize`Authentication failed.`, $localize`Close`, { duration: 5000 });
this.snackBar.open($localize`Authentication failed.`, $localize`Close`, {duration: 5000});
});
} else {
this.snackBar.open($localize`Please, fill the inputs before send.`, $localize`Close`, { duration: 5000 });
this.snackBar.open($localize`Please, fill the inputs before send.`, $localize`Close`, {duration: 5000});
}
}