Skip to content

response on catch? #54

@fenixphp

Description

@fenixphp

How to get a response from the server in "catch"?

    model
    .withParams(credentials)
    .post()
    .then((success) => {
      /* Set data. */
     commit('setUser', success.data.data.user);
    })
    .catch((error) => {
      if (error.data.data.message) {
        commit('setErrors', [error.data.data.message]);
      }
    });

Instead, the error object:

Error: Request failed with status code 422
    at createError (D:\Projects\Desionlab\Alex south\fastPanel\terminal\Source\node_modules\axios\lib\core\createError.js:16)
    at settle (D:\Projects\Desionlab\Alex south\fastPanel\terminal\Source\node_modules\axios\lib\core\settle.js:18)
    at XMLHttpRequest.handleLoad (D:\Projects\Desionlab\Alex south\fastPanel\terminal\Source\node_modules\axios\lib\adapters\xhr.js:77)

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions