umijs报错Error: Objects are not valid as a React child (found: object with keys {code, message}).

Since the error returned is a json, it is now processed directly as a string

Solution:

 if(error.response.status>400){
            message.error(error.data);
        }

To

 if(error.response.status>400){
            message.error(error.data.message?error.data.message:error.data);
        }

 

Guess you like

Origin blog.csdn.net/chendongpu/article/details/111621688