Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform Check Auth call to async/await #67

Open
igeligel opened this issue Oct 12, 2018 · 1 comment
Open

Transform Check Auth call to async/await #67

igeligel opened this issue Oct 12, 2018 · 1 comment

Comments

@igeligel
Copy link
Collaborator

Issue Summary:

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

[CHECK_AUTH](context) {
  if (JwtService.getToken()) {
    ApiService.setHeader();
    ApiService.get("user")
      .then(({ data }) => {
        context.commit(SET_AUTH, data.user);
      })
      .catch(({ response }) => {
        context.commit(SET_ERROR, response.data.errors);
      });
  } else {
    context.commit(PURGE_AUTH);
  }
}

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

Resources:

Acceptance Criteria:

  • A test is introduced, this is perfect work for TDD
  • There is no .then(... or .catch(... block or any promise like structure

The main issue can be found here #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants