1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var core_1 = require("@angular/core");
|
4 | var Observable_1 = require("rxjs/Observable");
|
5 | var store_1 = require("@ngrx/store");
|
6 | var config_1 = require("@soushians/config");
|
7 | var models_1 = require("../../models");
|
8 | var FeatureReducer = require("../../feature/feature.reducers");
|
9 | var edit_profile_actions_1 = require("../edit-profile.actions");
|
10 | var ProfileEditContainerComponent = (function () {
|
11 |
|
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 |
|
18 |
|
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 |
|
44 | ProfileEditContainerComponent.ctorParameters = function () { return [
|
45 | { type: store_1.Store, },
|
46 | ]; };
|
47 | return ProfileEditContainerComponent;
|
48 | }());
|
49 | exports.ProfileEditContainerComponent = ProfileEditContainerComponent;
|
50 |
|
\ | No newline at end of file |