AO
Size: a a a
AO
ОС
SФ
D
S
ОС
this.reloadTrigger$.pipe(
startWith(), // запуск первого запроса при инициализации все равно нужен
tap(() => {
this.loading = true
}),
switchMap(() => this.periodService.getPeriodList().pipe(
tap(() => {
// это не должно здесь жить, но хотя бы переделай в функцию
this.loginService.setClose(new Date(data.maxPeriod));
}),
// inner Observable pipe, so that it doesn't collapse the outer stream on error
map(data => {
const periodList = data.response;
// тут все подсчеты можно сделать - это будет pure function, вне класса компонента (можно в том же файле)
const periods = calculatePeriods(data);
return {
...periods, // тут все твои dateStartPeriod и т.д.
periodList
};
}),
// handles both complete (it's a one-time Observable) and error cases
finalize(() => this.loading = false),
// do not let the error go through
catchError(() => EMPTY),
),
takeUntil(this.destroy), // это уже в outer Observable pipe
).subscribe();
AO
AO
startWith(undefined)
на всякий случай. Может и надо. По идее там простой concat(of())
прячемся под statrWith()
, может этому of что-то и надоSФ
ОС
startWith(undefined)
на всякий случай. Может и надо. По идее там простой concat(of())
прячемся под statrWith()
, может этому of что-то и надоAO
ОС
ОС
A
DМ
A
SФ
ОС
AO
*ngIf="vm$ | async as vm"
ОС
*ngIf="vm$ | async as vm"