Giter Club home page Giter Club logo

curso-gratuito-svelte's Introduction

curso-gratuito-svelte's People

Contributors

midudev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

curso-gratuito-svelte's Issues

res.ok is not a function

El problema es que ok es un atributo, no una función. Si se muestra el error en el template de Svelte indica de dónde viene el fallo.

{:catch error}
    <strong>❌ {error.message}</strong>
{/await}
res.ok is not a function

El problema es que sustituyendo res.ok() por res.ok tampoco se soluciona, porque hay usar throw para lanzar el error. Si simplemente devolvemos el error, lo caza el siguiente then, y el error que muestra es res.json is not a function

Como no podemos usar throw en una closure de una sola línea, al final me ha quedado así:

response = fetch(`https://www.omdbapi.com/?s=${value}&apikey=api_key`)
            .then(res => {
                if (!res.ok) {
                    throw new Error("Something bad happened with the fetching of movies")
                }
                else {
                    return res;
                }
            })
            .then(res => res.json())
            .then(apiResponse => apiResponse.Search || []);

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.