UNPKG

my-test123

Version:
64 lines 2.83 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Store } from '@ngrx/store'; import { Actions, Effect } from '@ngrx/effects'; import { Injectable } from '@angular/core'; import * as FilterActions from './../actions/filter.actions'; import { Observable } from 'rxjs'; import { FilterService } from './../services/filter.service'; import { Notifications, NotificationType } from "ngx-base"; var FilterEffects = /** @class */ (function () { function FilterEffects(actions$, filterService, notifications, store) { var _this = this; this.actions$ = actions$; this.filterService = filterService; this.notifications = notifications; this.store = store; this.GetFilters$ = this.actions$ .ofType(FilterActions.GET) .withLatestFrom(this.store.select('listPage').select('space')) .switchMap(function (_a) { var action = _a[0], space = _a[1]; return _this.filterService.getFilters2(space.links.filters) .map(function (types) { return new FilterActions.GetSuccess(types); }) .catch(function (e) { try { _this.notifications.message({ message: 'Problem in fetching filters.', type: NotificationType.DANGER }); } catch (e) { console.log('Problem in fetching filters'); } return Observable.of(new FilterActions.GetError()); }); }); } FilterEffects.decorators = [ { type: Injectable }, ]; /** @nocollapse */ FilterEffects.ctorParameters = function () { return [ { type: Actions, }, { type: FilterService, }, { type: Notifications, }, { type: Store, }, ]; }; __decorate([ Effect(), __metadata("design:type", Observable) ], FilterEffects.prototype, "GetFilters$", void 0); return FilterEffects; }()); export { FilterEffects }; //# sourceMappingURL=filter.effects.js.map