As shown in the picture. The data actually returned to me by the backend is in the second layer of data.
How should I do a layer of data processing globally? Where is the best place to do it?
伊谢尔伦2017-05-15 17:01:10
angular.module('my', [])
.config(function ($httpProvider) {
$httpProvider.interceptors.push(function () {
return {
response: function (response) {
if (200 === response.data.code) {
response.data = response.data.data;
}
return response;
}
}
});
})