Codota Logo For Javascript
umi-request
Code IndexAdd Codota to your IDE (free)

How to use umi-request

Best JavaScript code snippets using umi-request(Showing top 2 results out of 315)

origin: sunft1996/ant-back

// request拦截器
request.interceptors.request.use((url, options) => {
 const token = localStorage.getItem('token');
 options.headers.Authorization = token;
 options.headers.RefererPath = window.document.location.pathname;
 options.headers.Terminal = 'client'; 
 return { url, options };
});
origin: hello-react/HoServer

// 拦截 request, 添加 token.
request.interceptors.request.use(async (url, options) => {
  const token = getToken()
  if (token) {
    const headers = {
      'token': token
    }

    return {
      url,
      options: {...options, headers}
    }
  }

  return {
    url,
    options: {...options},
  }
})
umi-request(npm)

Most used umi-request functions

  • RequestMethod.interceptors
  • request
  • use
  • RequestOptionsInit.headers

Popular in JavaScript

  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • mocha
    simple, flexible, fun test framework
  • crypto
  • body-parser
    Node.js body parsing middleware
  • express
    Fast, unopinionated, minimalist web framework
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • request
    Simplified HTTP request client.
  • fs
  • moment
    Parse, validate, manipulate, and display dates
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now