search

Home  >  Q&A  >  body text

javascript - How does the vue project intercept certain http requests and then rewrite the url?

Currently, I am working on a login authentication module. I want to use jwt for authentication, store it in the client loaclstorage, and add token to the request header. However, it is troublesome to modify the request headers one by one. Is there any simplified method?

Thanks

过去多啦不再A梦过去多啦不再A梦2775 days ago501

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:42:50

    Please refer to http://www.cnblogs.com/dupd/p...
    As long as you intercept the http request, modify the URL, header, etc., it is easy. This is global and will intercept all http requests initiated using vue.

    reply
    0
  • Cancelreply