UNPKG

my-test123

Version:
66 lines 3.11 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 GroupTypeActions from './../actions/group-type.actions'; import { Observable } from 'rxjs'; import { GroupTypesService as GTService } from './../services/group-types.service'; import { GroupTypeMapper } from './../models/group-types.model'; import { Notifications, NotificationType } from "ngx-base"; var GroupTypeEffects = /** @class */ (function () { function GroupTypeEffects(actions$, groupTypeService, notifications, store) { var _this = this; this.actions$ = actions$; this.groupTypeService = groupTypeService; this.notifications = notifications; this.store = store; this.getGroupTypes$ = this.actions$ .ofType(GroupTypeActions.GET) .withLatestFrom(this.store.select('listPage').select('space')) .switchMap(function (_a) { var action = _a[0], space = _a[1]; return _this.groupTypeService.getGroupTypes2(space.relationships.workitemtypegroups.links.related) .map(function (types) { var gtm = new GroupTypeMapper(); return new GroupTypeActions.GetSuccess(types.map(function (t) { return gtm.toUIModel(t); })); }) .catch(function (e) { try { _this.notifications.message({ message: "Problem in fetching grouptypes.", type: NotificationType.DANGER }); } catch (e) { console.log('Problem in fetching grouptypes.'); } return Observable.of(new GroupTypeActions.GetError()); }); }); } GroupTypeEffects.decorators = [ { type: Injectable }, ]; /** @nocollapse */ GroupTypeEffects.ctorParameters = function () { return [ { type: Actions, }, { type: GTService, }, { type: Notifications, }, { type: Store, }, ]; }; __decorate([ Effect(), __metadata("design:type", Observable) ], GroupTypeEffects.prototype, "getGroupTypes$", void 0); return GroupTypeEffects; }()); export { GroupTypeEffects }; //# sourceMappingURL=group-type.effects.js.map