Skip to content

Commit 913a3a4

Browse files
authored
fix: avoid multiple success message in accounts (#3423)
1 parent 7a47254 commit 913a3a4

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

app/components/forms/user-payment-info-form.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import Component from '@ember/component';
22
import FormMixin from 'open-event-frontend/mixins/form';
33
import { validPhoneNumber } from 'open-event-frontend/utils/validators';
44
import { pick, orderBy } from 'lodash-es';
5-
import { action, computed } from '@ember/object';
5+
import { computed } from '@ember/object';
66
import { countries } from 'open-event-frontend/utils/dictionary/demography';
77

8-
export default class extends Component.extend(FormMixin) {
8+
export default Component.extend(FormMixin, {
99
didInsertElement() {
10-
super.didInsertElement(...arguments);
10+
this._super(...arguments);
1111
this.set('userBillingInfo', pick(this.authManager.currentUser, ['billingContactName', 'billingCity', 'billingPhone', 'company', 'billingTaxInfo', 'billingCountry', 'billingState', 'billingAddress', 'billingZipCode', 'billingAdditionalInfo']));
12-
}
12+
},
1313

1414
getValidationRules() {
1515
return {
@@ -88,26 +88,26 @@ export default class extends Component.extend(FormMixin) {
8888
}
8989
}
9090
};
91-
}
91+
},
9292

93-
@computed()
94-
get countries() {
93+
countries: computed(function() {
9594
return orderBy(countries, 'name');
96-
}
95+
}),
9796

98-
@action
99-
submit() {
100-
this.onValid(async() => {
101-
this.set('isLoading', true);
102-
try {
103-
this.authManager.currentUser.setProperties(this.userBillingInfo);
104-
await this.authManager.currentUser.save();
105-
this.notify.success(this.l10n.t('Your billing details has been updated'));
106-
} catch (error) {
107-
this.authManager.currentUser.rollbackAttributes();
108-
this.notify.error(this.l10n.t('An unexpected error occurred'));
109-
}
110-
this.set('isLoading', false);
111-
});
97+
actions: {
98+
submit() {
99+
this.onValid(async() => {
100+
this.set('isLoading', true);
101+
try {
102+
this.authManager.currentUser.setProperties(this.userBillingInfo);
103+
await this.authManager.currentUser.save();
104+
this.notify.success(this.l10n.t('Your billing details has been updated'));
105+
} catch (error) {
106+
this.authManager.currentUser.rollbackAttributes();
107+
this.notify.error(this.l10n.t('An unexpected error occurred'));
108+
}
109+
this.set('isLoading', false);
110+
});
111+
}
112112
}
113-
}
113+
});

0 commit comments

Comments
 (0)