UNPKG

2.46 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var core_1 = require("@angular/core");
4var Observable_1 = require("rxjs/Observable");
5var store_1 = require("@ngrx/store");
6var config_1 = require("@soushians/config");
7var models_1 = require("../../models");
8var FeatureReducer = require("../../feature/feature.reducers");
9var edit_profile_actions_1 = require("../edit-profile.actions");
10var ProfileEditContainerComponent = /** @class */ (function () {
11 // constructor(private diagramService: DiagramService, private store: Store<FeatureReducer.FeatureState>) {
12 function ProfileEditContainerComponent(store) {
13 this.store = store;
14 this.formGroup = models_1.EditProfile_ApiModel.Request.formGroup;
15 this.userInforamation$ = this.store.select(FeatureReducer.getUser);
16 this.appConfig = this.store.select(config_1.getAppConfig);
17 // TODO:
18 // this.groups = this.diagramService.getGroups();
19 this.groups = Observable_1.Observable.of(["test1", "test2"]);
20 }
21 ProfileEditContainerComponent.prototype.ngOnInit = function () {
22 var _this = this;
23 this.userInforamation$.subscribe(function (userInfo) {
24 debugger;
25 if (userInfo == null)
26 return;
27 _this.formGroup.patchValue({
28 Email: userInfo.Email,
29 Roles: userInfo.Roles,
30 Groups: userInfo.Groups
31 });
32 });
33 };
34 ProfileEditContainerComponent.prototype.updateProfile = function (data) {
35 this.store.dispatch(new edit_profile_actions_1.EditProfile(data));
36 };
37 ProfileEditContainerComponent.decorators = [
38 { type: core_1.Component, args: [{
39 selector: "profile-edit-contianer",
40 template: "<profile-edit\n (submited)='updateProfile($event)'\n [formGroup]=\"formGroup\"\n [roles]=\"(appConfig | async)?.Config.Roles\"\n [groups]=\"groups | async\"\n ></profile-edit>"
41 },] },
42 ];
43 /** @nocollapse */
44 ProfileEditContainerComponent.ctorParameters = function () { return [
45 { type: store_1.Store, },
46 ]; };
47 return ProfileEditContainerComponent;
48}());
49exports.ProfileEditContainerComponent = ProfileEditContainerComponent;
50//# sourceMappingURL=profile-edit-container.component.js.map
\No newline at end of file