Skip to content

Commit

Permalink
Use Promise.all rather than $.when
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Francisco <[email protected]>
  • Loading branch information
ndg63276 and gfrn authored Sep 12, 2023
1 parent 0f77ed1 commit bfa8044
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/js/modules/contact/views/addcontact.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ define(['views/form',
initialize: function() {
this.countries = new Countries()
this.countries.state.pageSize = 9999
this.ready = this.countries.fetch()
this.users = new Users()
this.users.queryParams.login = 1
this.ready2 = this.users.fetch()
},

createModel: function() {
this.model = new Contact()
},

onRender: function() {
$.when(this.ready).done(this.populateCountries.bind(this))
$.when(this.ready2).done(this.populateUsers.bind(this))
Promise.all([this.countries.fetch(), this.users.fetch()]).then(() => {
this.populateCountries();
this.populateUsers();
})
},

populateCountries: function() {
Expand Down

0 comments on commit bfa8044

Please sign in to comment.