Skip to content

Response status checking #3

@KKSzymanowski

Description

@KKSzymanowski

I have a concern about this piece of code:

axios[requestType](url, this.data())
    .then(response => {
        this.onSuccess(response.data);

        resolve(response.data);
    })
    .catch(error => {
        this.onFail(error.response.data);

        reject(error.response.data);
    });

Shouldn't you check if error.response.status is 422 before you record errors?
If the server returns eg. 403 or 500, the Errors::errors would contain the whole HTML response which might cause some fatal errors.

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