Tabnine Logo For Javascript
umi-request
Code IndexAdd Tabnine 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

  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • lodash
    Lodash modular utilities.
  • ms
    Tiny millisecond conversion utility
  • async
    Higher-order functions and common patterns for asynchronous code
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • crypto
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • request
    Simplified HTTP request client.
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now