@sprucelabs/spruce-profile-utils 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,26 +61,29 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
handleSubmit() {
|
|
64
|
-
var _a, _b, _c;
|
|
64
|
+
var _a, _b, _c, _d;
|
|
65
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
66
|
try {
|
|
67
67
|
const client = yield this.connectToApi();
|
|
68
68
|
const values = this.formVc.getValues();
|
|
69
69
|
yield client.emitAndFlattenResponses('update-person::v2020_12_25', {
|
|
70
|
+
target: {
|
|
71
|
+
personId: (_a = this.person) === null || _a === void 0 ? void 0 : _a.id,
|
|
72
|
+
},
|
|
70
73
|
payload: Object.assign({}, values),
|
|
71
74
|
});
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
(
|
|
75
|
+
const loggedInPerson = this.authenticator.getPerson();
|
|
76
|
+
const updatedPerson = Object.assign(Object.assign({}, this.person), values);
|
|
77
|
+
if (loggedInPerson.id === ((_b = this.person) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
78
|
+
const token = this.authenticator.getSessionToken();
|
|
79
|
+
(_c = this.authenticator) === null || _c === void 0 ? void 0 : _c.setSessionToken(token, updatedPerson);
|
|
77
80
|
}
|
|
78
81
|
yield this.alert({
|
|
79
82
|
title: 'Changes saved!',
|
|
80
83
|
message: 'Your profile has been updated. This is so much fun!',
|
|
81
84
|
style: 'success',
|
|
82
85
|
});
|
|
83
|
-
yield ((
|
|
86
|
+
yield ((_d = this.onSubmitHandler) === null || _d === void 0 ? void 0 : _d.call(this, updatedPerson));
|
|
84
87
|
}
|
|
85
88
|
catch (err) {
|
|
86
89
|
yield this.alert({ message: err.message, style: 'error' });
|
|
@@ -54,25 +54,28 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
54
54
|
}));
|
|
55
55
|
}
|
|
56
56
|
async handleSubmit() {
|
|
57
|
-
var _a, _b, _c;
|
|
57
|
+
var _a, _b, _c, _d;
|
|
58
58
|
try {
|
|
59
59
|
const client = await this.connectToApi();
|
|
60
60
|
const values = this.formVc.getValues();
|
|
61
61
|
await client.emitAndFlattenResponses('update-person::v2020_12_25', {
|
|
62
|
+
target: {
|
|
63
|
+
personId: (_a = this.person) === null || _a === void 0 ? void 0 : _a.id,
|
|
64
|
+
},
|
|
62
65
|
payload: Object.assign({}, values),
|
|
63
66
|
});
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(
|
|
67
|
+
const loggedInPerson = this.authenticator.getPerson();
|
|
68
|
+
const updatedPerson = Object.assign(Object.assign({}, this.person), values);
|
|
69
|
+
if (loggedInPerson.id === ((_b = this.person) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
70
|
+
const token = this.authenticator.getSessionToken();
|
|
71
|
+
(_c = this.authenticator) === null || _c === void 0 ? void 0 : _c.setSessionToken(token, updatedPerson);
|
|
69
72
|
}
|
|
70
73
|
await this.alert({
|
|
71
74
|
title: 'Changes saved!',
|
|
72
75
|
message: 'Your profile has been updated. This is so much fun!',
|
|
73
76
|
style: 'success',
|
|
74
77
|
});
|
|
75
|
-
await ((
|
|
78
|
+
await ((_d = this.onSubmitHandler) === null || _d === void 0 ? void 0 : _d.call(this, updatedPerson));
|
|
76
79
|
}
|
|
77
80
|
catch (err) {
|
|
78
81
|
await this.alert({ message: err.message, style: 'error' });
|