@snabcentr/client-ui 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Input, Output
|
|
3
3
|
import * as i10 from 'rxjs';
|
4
4
|
import { Subject, filter, map, switchMap, tap, catchError, of, finalize, startWith, share, timer, scan, takeWhile, endWith, distinctUntilChanged, shareReplay, interval, takeUntil, skip, debounceTime, merge, combineLatest, throwError } from 'rxjs';
|
5
5
|
import * as i1 from '@snabcentr/client-core';
|
6
|
-
import { SC_URLS, SC_PATH_IMAGE_NOT_FOUND, ScCatalogService, ScCartService, ScIconTypesEnum, ScUserService, ScISuggestionType } from '@snabcentr/client-core';
|
6
|
+
import { SC_URLS, SC_PATH_IMAGE_NOT_FOUND, ScCatalogService, ScCartService, ScAuthService, ScIconTypesEnum, ScUserService, ScISuggestionType } from '@snabcentr/client-core';
|
7
7
|
import * as i2 from '@angular/common';
|
8
8
|
import { CommonModule, formatDate } from '@angular/common';
|
9
9
|
import * as i4 from '@taiga-ui/core';
|
@@ -1788,10 +1788,11 @@ const SC_PRODUCT_PAGINATION_PARAMS = tuiCreateToken(paginationParams$);
|
|
1788
1788
|
*
|
1789
1789
|
* @param catalogService Сервис для работы с каталогом.
|
1790
1790
|
* @param cartService Сервис для работы с корзиной.
|
1791
|
+
* @param authService Сервис для работы с аутентификации пользователей.
|
1791
1792
|
* @param destroy$ Сервис завершения {@link Observable} через `takeUntil`.
|
1792
1793
|
*/
|
1793
|
-
function productsPaginationChangeFactory({ paramMap }, catalogService, cartService, destroy$) {
|
1794
|
-
return paramMap.pipe(map((params) => params.get('categoryId')), filter(tuiIsPresent), switchMap((categoryId) => paginationParams$.pipe(debounceTime(20), switchMap((paginationParams) => catalogService.getCategoryProducts$(Number(categoryId), paginationParams)), filter(tuiIsPresent), scan((acc, value) => {
|
1794
|
+
function productsPaginationChangeFactory({ paramMap }, catalogService, cartService, authService, destroy$) {
|
1795
|
+
return paramMap.pipe(map((params) => params.get('categoryId')), filter(tuiIsPresent), switchMap((categoryId) => paginationParams$.pipe(debounceTime(20), switchMap((paginationParams) => authService.getAuthChange().pipe(switchMap(() => catalogService.getCategoryProducts$(Number(categoryId), paginationParams)))), filter(tuiIsPresent), scan((acc, value) => {
|
1795
1796
|
if (acc && value && value.meta.currentPage > 1)
|
1796
1797
|
value.data.unshift(...acc.data);
|
1797
1798
|
return value;
|
@@ -1841,7 +1842,7 @@ const SC_PRODUCT_PAGINATION_CHANGE_PROVIDERS = [
|
|
1841
1842
|
TuiDestroyService,
|
1842
1843
|
{
|
1843
1844
|
provide: SC_PRODUCT_PAGINATION_CHANGE_INFO,
|
1844
|
-
deps: [ActivatedRoute, ScCatalogService, ScCartService, TuiDestroyService],
|
1845
|
+
deps: [ActivatedRoute, ScCatalogService, ScCartService, ScAuthService, TuiDestroyService],
|
1845
1846
|
useFactory: productsPaginationChangeFactory,
|
1846
1847
|
},
|
1847
1848
|
{
|