@suntelecoms/ngx-dynamic-form 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://angular.dev)
|
|
6
6
|
[](https://material.angular.io)
|
|
7
|
-
[](CHANGELOG.md)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](mailto:amadoumacbookpro38@gmail.com)
|
|
10
10
|
|
|
@@ -1419,6 +1419,9 @@ export type { SelectOption }
|
|
|
1419
1419
|
|
|
1420
1420
|
## Changelog
|
|
1421
1421
|
|
|
1422
|
+
### v1.3.1
|
|
1423
|
+
- **Fix boucle infinie auth** : `NgxFormsAuthService` utilise désormais `HttpBackend` au lieu de `HttpClient` pour la requête de login — l'intercepteur `ngxFormsAuthInterceptor` n'intercepte plus la requête de login elle-même, évitant une récursion infinie qui empêchait le chargement des formulaires
|
|
1424
|
+
|
|
1422
1425
|
### v1.3.0
|
|
1423
1426
|
- **Authentification Bearer token** : nouvelle option `auth` dans `provideNgxForms({ auth: { loginUrl, username, password } })`
|
|
1424
1427
|
- **`ngxFormsAuthInterceptor`** : intercepteur HTTP fonctionnel à ajouter dans `provideHttpClient(withInterceptors([ngxFormsAuthInterceptor]))` — injecte automatiquement le header `Authorization: Bearer <token>` sur toutes les requêtes
|
|
@@ -4,7 +4,7 @@ import { JsonPipe } from '@angular/common';
|
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { FormControl, FormGroup, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
6
6
|
import { MatIconButton, MatButton } from '@angular/material/button';
|
|
7
|
-
import { HttpClient } from '@angular/common/http';
|
|
7
|
+
import { HttpClient, HttpBackend } from '@angular/common/http';
|
|
8
8
|
import { MatFormField, MatLabel, MatError, MatHint, MatPrefix, MatSuffix } from '@angular/material/form-field';
|
|
9
9
|
import { MatInput } from '@angular/material/input';
|
|
10
10
|
import { MatSelect } from '@angular/material/select';
|
|
@@ -274,7 +274,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
274
274
|
const NGX_FORMS_AUTH = new InjectionToken('NGX_FORMS_AUTH');
|
|
275
275
|
class NgxFormsAuthService {
|
|
276
276
|
constructor() {
|
|
277
|
-
|
|
277
|
+
// HttpBackend bypass tous les intercepteurs → évite la boucle infinie
|
|
278
|
+
// (l'intercepteur auth intercepterait sinon la requête de login elle-même)
|
|
279
|
+
this.http = new HttpClient(inject(HttpBackend));
|
|
278
280
|
this.config = inject(NGX_FORMS_AUTH);
|
|
279
281
|
this.token = null;
|
|
280
282
|
this.expiresAt = 0;
|
|
@@ -291,7 +293,6 @@ class NgxFormsAuthService {
|
|
|
291
293
|
})
|
|
292
294
|
.pipe(map(r => {
|
|
293
295
|
this.token = r.data.accessToken;
|
|
294
|
-
// 10 secondes de marge avant expiry
|
|
295
296
|
this.expiresAt = Date.now() + (r.data.expiresIn - 10) * 1000;
|
|
296
297
|
return this.token;
|
|
297
298
|
}));
|