@sprucelabs/spruce-profile-utils 3.0.1 → 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.
|
@@ -20,7 +20,7 @@ export interface ProfileCardLoadOptions {
|
|
|
20
20
|
authenticator: Authenticator;
|
|
21
21
|
locale: Locale;
|
|
22
22
|
}
|
|
23
|
-
export type OnSubmitHandler = (person
|
|
23
|
+
export type OnSubmitHandler = (person: Person) => Promise<void>;
|
|
24
24
|
export interface ProfileCardViewControllerOptions {
|
|
25
25
|
onSubmit?: OnSubmitHandler;
|
|
26
26
|
}
|
|
@@ -67,12 +67,17 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
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
|
-
|
|
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);
|
|
80
|
+
}
|
|
76
81
|
yield this.alert({
|
|
77
82
|
title: 'Changes saved!',
|
|
78
83
|
message: 'Your profile has been updated. This is so much fun!',
|
|
@@ -20,7 +20,7 @@ export interface ProfileCardLoadOptions {
|
|
|
20
20
|
authenticator: Authenticator;
|
|
21
21
|
locale: Locale;
|
|
22
22
|
}
|
|
23
|
-
export type OnSubmitHandler = (person
|
|
23
|
+
export type OnSubmitHandler = (person: Person) => Promise<void>;
|
|
24
24
|
export interface ProfileCardViewControllerOptions {
|
|
25
25
|
onSubmit?: OnSubmitHandler;
|
|
26
26
|
}
|
|
@@ -59,12 +59,17 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
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
|
-
|
|
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);
|
|
72
|
+
}
|
|
68
73
|
await this.alert({
|
|
69
74
|
title: 'Changes saved!',
|
|
70
75
|
message: 'Your profile has been updated. This is so much fun!',
|