如何设置TimeTime轴响应-React.js

时间:2018-11-06 07:23:35

标签: reactjs axios

是否可以setTimeOut响应接下来的axios呼叫?

export function getMetricsByContent(metricsParams) {
    console.log('metricsParams: ', metricsParams);
    return (dispatch) => {
        return axios.post(`/rbac/aa/reads/getReport`, metricsParams).then((response) => {
            console.log('metricsApiResponse: ', response);
            if (response.status !== 200) {
                throw Error(response.statusText);
            }
            return response;
        }).then((response) => {
            if (response) {
                return response.data.msg;
            } else {
                return "No content available";
            }

        })
            .catch((err) => {return err});
        };

}

0 个答案:

没有答案