gothinkster / vue-realworld-example-app

An exemplary real-world application built with Vue.js, Vuex, axios and different other technologies. This is a good example to discover Vue for beginners.
https://vue-vuex-realworld.netlify.com
MIT License
4.07k stars 1.3k forks source link

Transform Register call to async/await #65

Open igeligel opened 5 years ago

igeligel commented 5 years ago

Issue Summary:

In the auth.module.js here you have got some code like:

[REGISTER](context, credentials) {
  return new Promise((resolve, reject) => {
    ApiService.post("users", { user: credentials })
      .then(({ data }) => {
        context.commit(SET_AUTH, data.user);
        resolve(data);
      })
      .catch(({ response }) => {
        context.commit(SET_ERROR, response.data.errors);
        reject(response);
      });
  });
}

Those promise calls could be simplified with async and await calls.

Resources:

Acceptance Criteria:

The main issue can be found here #5

moozzyk commented 5 years ago

I can take this one.