GithubHelp home page GithubHelp logo

Comments (3)

rogerjin12 avatar rogerjin12 commented on May 19, 2024

Per #1 , can you give that a try let me know if that resolves this issue?

from buttercms-js.

vik-buchinski-azati avatar vik-buchinski-azati commented on May 19, 2024

@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:

  1. Fetch posts
  2. Request cancelled by timeout
  3. .then callback called with appropriate status and statusMessage (but on this step nothing called or returned)

from buttercms-js.

rogerjin12 avatar rogerjin12 commented on May 19, 2024

@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)
  });

from buttercms-js.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.