0
的特性 '切片',而做了一些反应,服务器端与终极版爱可信:无法读取得到这个错误空
堆栈跟踪
TypeError: Cannot read property 'slice' of null
at dispatchHttpRequest (E:\Projects\real-estate\node_modules\axios\lib\adapters\http.js:84:37)
at httpAdapter (E:\Projects\real-estate\node_modules\axios\lib\adapters\http.js:19:10)
at dispatchRequest (E:\Projects\real-estate\node_modules\axios\lib\core\dispatchRequest.js:52:10)
at process._tickCallback (internal/process/next_tick.js:103:7)
行动
import axios from 'axios';
export const FETCH_USER = 'FETCH_USER';
export const FETCH_POSTS = 'FETCH_POSTS';
const GET_POSTS_URI = '/api/posts';
export const fetchPosts =() => {
let posts = axios.get(GET_POSTS_URI).catch(err => console.log(err));
return {
type: FETCH_POSTS,
payload: posts
}
}
API
渲染app.get('/api/posts', function(req, res, next) {
Post.model.find()
.exec()
.then(function(posts) {
res.send(posts);
}, function(err) {
return next(err);
});
})
我还有在开发工具的网络选项卡中的JSON响应,但我无法检索减速器中的JSON响应。我也没有得到这个错误,当我使用OpenWeatherAPI