GithubHelp home page GithubHelp logo

stun3r / nuxt-strapi-sdk Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 3.0 6.78 MB

๐Ÿ“ฆ Easy integration Strapi with Nuxt.js!

Home Page: https://strapi-sdk-nuxtjs.netlify.com/

License: MIT License

JavaScript 99.06% Vue 0.94%

nuxt-strapi-sdk's People

Contributors

billybobbonnet avatar dependabot[bot] avatar stun3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nuxt-strapi-sdk's Issues

How catch 'bad request' from Strapi ?

Hi,

Thanks for this library, i have a question, how i can catch a bad request message from Strapi ?

// with axios
      this.$axios.post('users/me', { data })
        .then((response) => {
          console.log(response)
        })
        .catch((error) => {
          console.log(error.response.data.message.shift().messages.shift().id)
          // console : Auth.form.error.email.format
        })

// with nuxt-strapi
      let send
      try {
        send = await this.$strapi.request('POST', 'users/me', { data })
        console.log(send.data)
      } catch (error) {
        
        console.log(error)
        /* console :
        Error: [object Object]
        at Strapi._callee$ (strapi.js?b045:26)
        at tryCatch (runtime.js?96cf:45)
        at Generator.invoke [as _invoke] (runtime.js?96cf:271)
        at Generator.prototype.<computed> [as throw] (runtime.js?96cf:97)
        at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
        at _throw (asyncToGenerator.js?1da1:29)
        */

        console.log(send)
        // undefined 

It work with this fix on request() from strapi.js, but i don't know if is the good way

    } catch (error) {
      if (error.response) {
        return error.response
        //throw new Error(error.response)
      } else {
        throw error
      }
    }

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.