Return a Promise for a JSON POST Given this method, we don't know which syntax is the more appropriate.

async finishUpgrade({id}) {
    return new Promise((resolve, reject) =&gt; {
      let options = {
        method: 'POST',
        uri: this.apiUrl + `${id}/?action=proceed`,
        body: {}
        json: true
      };

      try {
        const res = await req(options);
        resolve(res);
      } catch(err) {
        reject(err);
      }
    });
  }


As you can see we use return new Promise(...). 

Would it be correct/a better way to refactor it this way:

async finishUpgrade({id}) {
  let options = {
    method: 'POST',
    uri: this.apiUrl + `${id}/?action=proceed`,
    body: {}
    json: true
  };

  try {
    const res = await req(options);
    return Promise.resolve(res);
  } catch(err) {
    return Promise.reject(err);
  }
}
Given this method, we don't know which syntax is the more appropriate.


Neither is appropriate as both your options employ promise anti-patterns (creating new promises when you can just work with and return the one you already have).  

Assuming req() already returns a promise (which you imply with your use of await), you should just return that promise directly.  I see no reason to even use async or await here.

// presumably from your use of this, this is a method declaration
function finishUpgrade({id}) {
  let options = {
    method: 'POST',
    uri: this.apiUrl + `${id}/?action=proceed`,
    body: {}
    json: true
  };
  return req(options);
}

this.finishUpgrade({id: someId}).then(result =&gt; {
    // upgrade done here
}).catch(err =&gt; {
    // error here
});




When you do need to modify the return value, you just add a .then() handler and the modified value you return from that .then() handler becomes the new resolved value:

// presumably from your use of this, this is a method declaration
function finishUpgrade({id}) {
  let options = {
    method: 'POST',
    uri: this.apiUrl + `${id}/?action=proceed`,
    body: {}
    json: true
  };
  return req(options).then(result =&gt; {
      // change the resolved value of the promise to our data object
      let data = { someData: someValue };
      data.response = result;
      return data;
  });
}

this.finishUpgrade({id: someId}).then(result =&gt; {
    // upgrade done here
}).catch(err =&gt; {
    // error here
});