Browse Source

fix(client): remove nested subscription

pull/6926/head
KenTandrian 3 days ago
parent
commit
8c2eff2b5a
  1. 11
      apps/client/src/app/components/home-summary/home-summary.component.ts

11
apps/client/src/app/components/home-summary/home-summary.component.ts

@ -18,6 +18,7 @@ import {
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { switchMap } from 'rxjs';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
@ -75,15 +76,13 @@ export class GfHomeSummaryComponent implements OnInit {
protected onChangeEmergencyFund(emergencyFund: number) { protected onChangeEmergencyFund(emergencyFund: number) {
this.dataService this.dataService
.putUserSetting({ emergencyFund }) .putUserSetting({ emergencyFund })
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(
.subscribe(() => { switchMap(() => this.userService.get(true)),
this.userService takeUntilDestroyed(this.destroyRef)
.get(true) )
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((user) => { .subscribe((user) => {
this.user.set(user); this.user.set(user);
}); });
});
} }
private update() { private update() {

Loading…
Cancel
Save