simple-dashboard icon indicating copy to clipboard operation
simple-dashboard copied to clipboard

getStatus() for StatusCode is not working properly

Open MiaMish opened this issue 6 years ago • 0 comments

It returns 'success' even for error status codes between 400 and 500.

I used the following code instead which works for me.

    getStatus() {
        return this.fetchData()
            .catch(response => {
                return response
            })
            .then(response => {

                console.log(response)
                if (response.status === 200) {
                    return {
                    title: this.title,
                    link: this.link,
                    status: "success",
                    messages: []
                };
                }
                return {
                    title: this.title,
                    link: this.link,
                    status: "danger",
                    messages: [{
                        message: "Request failed: " + response.message || 'unknown'
                    }]
                };
            });

MiaMish avatar Nov 01 '18 12:11 MiaMish