Renommage de code
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
<h1>Les appels réseaux - Promesses ou Observables ?</h1>
|
||||
<div class="actions">
|
||||
<button mat-raised-button
|
||||
(click)="loadCar()"
|
||||
(click)="loadCarViaAPromise()"
|
||||
[disabled]="isLoading$ | async">
|
||||
Load the car
|
||||
🙏 Load the car via a Promise
|
||||
</button>
|
||||
|
||||
<button mat-raised-button
|
||||
(click)="loadCarViaAnObservable()"
|
||||
[disabled]="isLoading$ | async">
|
||||
Load the car
|
||||
👁️ Load the car via an Observable
|
||||
</button>
|
||||
</div>
|
||||
<div class="loading" *ngIf="isLoading$ | async">
|
||||
|
||||
@@ -26,7 +26,7 @@ export class NetworkCallComponent {
|
||||
return this.isLoadingSubject.asObservable();
|
||||
}
|
||||
|
||||
loadCar(): void {
|
||||
loadCarViaAPromise(): void {
|
||||
this.loadThroughAPromise();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ObservablesExampleComponent } from './observables-example.component';
|
||||
|
||||
describe('ObservablesExampleComponent', () => {
|
||||
let component: ObservablesExampleComponent;
|
||||
let fixture: ComponentFixture<ObservablesExampleComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ObservablesExampleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ObservablesExampleComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -2,13 +2,11 @@
|
||||
<h1>Les promesses</h1>
|
||||
<div class="actions">
|
||||
<button mat-raised-button (click)="showCarViaAPromise()" [disabled]="isLoading">
|
||||
<mat-icon>visibility</mat-icon>
|
||||
Show car via a Promise
|
||||
🙏 Show car via a Promise
|
||||
</button>
|
||||
|
||||
<button mat-raised-button (click)="showCarViaAsyncAwaitProcess()" [disabled]="isLoading">
|
||||
<mat-icon>visibility</mat-icon>
|
||||
Show car via an Async Await process
|
||||
⏱️ Show car via an Async Await process
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PromisesExampleComponent } from './promises-example.component';
|
||||
|
||||
describe('PromisesExampleComponent', () => {
|
||||
let component: PromisesExampleComponent;
|
||||
let fixture: ComponentFixture<PromisesExampleComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PromisesExampleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(PromisesExampleComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -43,7 +43,7 @@ export class PromisesExampleComponent {
|
||||
this.isLoaded = true;
|
||||
})
|
||||
.catch(error => {
|
||||
this.snackBar.open(`Error while loading car. Cause : ${error}`);
|
||||
this.snackBar.open(`Error while loading car. Cause : ${error}`, 'Close', { duration: 5000 });
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
@@ -78,7 +78,7 @@ export class PromisesExampleComponent {
|
||||
this.car = await this.findViaAsyncAwaitProcess();
|
||||
this.isLoaded = true;
|
||||
} catch (error) {
|
||||
this.snackBar.open(`Error while loading car. Cause : ${error}`);
|
||||
this.snackBar.open(`Error while loading car. Cause : ${error}`, 'Close', { duration: 5000 });
|
||||
}
|
||||
|
||||
this.numberOfLoadings++;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StateManagementExampleComponent } from './state-management-example.component';
|
||||
|
||||
describe('StateManagementExampleComponent', () => {
|
||||
let component: StateManagementExampleComponent;
|
||||
let fixture: ComponentFixture<StateManagementExampleComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ StateManagementExampleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(StateManagementExampleComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user