Closed vik-buchinski-azati closed 7 years ago
@rogerjin12 I tested, and I see, that this case still doesn't work. my code:
this.butter.post.list({ page: pageNumber, page_size: pageSize }).then(
(response) => {
clearTimeout(this.butterErrorTimeout); // timeout bugfix
let newState = {};
if (response.status === 200) {
newState = {
posts: response.data.data,
pagination: response.data.meta,
currentPage: pageNumber,
};
}
newState = {
...newState,
loading: false,
};
this.setState(newState);
}
);
So, how i see, that it should work:
@vik-buchinski-azati Hi Victor. I investigated this and an error is returned. You need to catch it as part of the promise callback chain. Try this:
var butter = require('buttercms')('your api token', true, 1);
butter.post.list({page: 1, page_size: 10})
.then(function(response) {
console.log(response.data)
}).catch(function(response) {
console.log('this is an error', response)
});
Per #1 , can you give that a try let me know if that resolves this issue?