Now reloading employee-card for every visit to avoid cache-problems

This commit is contained in:
Erik Tiekstra
2021-09-13 08:11:28 +02:00
parent 51d42b1669
commit c81d7fb38c
5 changed files with 5 additions and 2 deletions

View File

@@ -131,7 +131,7 @@
</footer>
</section>
<ng-template #loadingRef>
<digi-ng-skeleton-base [afCount]="3" afText="Laddar personalkortet"></digi-ng-skeleton-base>
<digi-ng-skeleton-base [afCount]="3" afText="Laddar personalkonto"></digi-ng-skeleton-base>
</ng-template>
<ng-template #emptyDD class="employee-card__list">
<dd>

View File

@@ -30,6 +30,7 @@ export class EmployeeCardComponent implements OnDestroy {
ngOnDestroy(): void {
this.employeeService.resetLastUpdatedEmployeeId();
this.employeeService.setCurrentEmployeeId(null);
}
get employeeId(): string {

View File

@@ -50,11 +50,11 @@ export class EmployeeService extends UnsubscribeDirective {
super.unsubscribeOnDestroy(
combineLatest([this._currentEmployeeId$, this._lastUpdatedEmployeeId$])
.pipe(
filter(([currentEmployeeId]) => !!currentEmployeeId),
distinctUntilChanged(
([prevEmployeeId], [currEmployeeId, currLastUpdatedEmployeeId]) =>
!currLastUpdatedEmployeeId && prevEmployeeId === currEmployeeId
),
filter(([currentEmployeeId]) => !!currentEmployeeId),
switchMap(([currentEmployeeId]) =>
this._fetchEmployee$(currentEmployeeId).pipe(filter(employee => !!employee))
)