Giter Site home page Giter Site logo

useAPI API 完善 about hooks HOT 3 CLOSED

brickspert avatar brickspert commented on May 20, 2024
useAPI API 完善

from hooks.

Comments (3)

crashsol avatar crashsol commented on May 20, 2024 1

useApi, 如果请求返回的是undefined 会提示错误,需要添加 对res的判断
async () => { const res = await requestMethod(opt.url, opt.options); return res && res.json && typeof res.json === 'function' ? res.json() : res; },

from hooks.

xiexingen avatar xiexingen commented on May 20, 2024

如何使用axios

from hooks.

ttys026 avatar ttys026 commented on May 20, 2024

如何使用axios

现在 useAPI 是基于 fetch 类请求库封装的,fetcher 类型是:
(url: string, options?: RequestInit) => Promise<any>
如果需要基于 axios,可以基于 useAsync 自己封装,方式上面可以参考 https://github.com/umijs/hooks/blob/master/src/useAPI/index.ts

from hooks.

Related Issues (20)

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.