Skip to content

Commit 6cafd46

Browse files
Validate authData before triggering beforeSave
1 parent db9b72b commit 6cafd46

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/RestWrite.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ RestWrite.prototype.execute = function() {
6767
return this.handleInstallation();
6868
}).then(() => {
6969
return this.handleSession();
70+
}).then(() => {
71+
return this.validateAuthData();
7072
}).then(() => {
7173
return this.runBeforeTrigger();
7274
}).then(() => {
7375
return this.setRequiredFieldsIfNeeded();
74-
}).then(() => {
75-
return this.validateAuthData();
7676
}).then(() => {
7777
return this.transformUser();
7878
}).then(() => {
@@ -134,6 +134,10 @@ RestWrite.prototype.validateSchema = function() {
134134
// Runs any beforeSave triggers against this operation.
135135
// Any change leads to our data being mutated.
136136
RestWrite.prototype.runBeforeTrigger = function() {
137+
if (this.response) {
138+
return;
139+
}
140+
137141
// Avoid doing any setup for triggers if there is no 'beforeSave' trigger for this class.
138142
if (!triggers.triggerExists(this.className, triggers.Types.beforeSave, this.config.applicationId)) {
139143
return Promise.resolve();

0 commit comments

Comments
 (0)