Axios with promise.prototype.finally doesn't work

后端 未结 2 1223
夕颜
夕颜 2021-01-18 06:34

Not sure what I am missing. Following the instructions here: https://github.com/mzabriskie/axios/blob/master/COOKBOOK.md

I have npm installed both axios and np

相关标签:
2条回答
  • 2021-01-18 06:54

    Try one of these see if it works:

    1. See if you have a global Promise available to shim it? Enter Promise in chrome console while the browserify is running the bundle. If you don't have it, use Babel or a lib that makes es6 or just Promise available.

    2. If it didn't work for some reason... well axios cookbook.md didn't get it right, since you have to call shim() to apply it on promise proto. why don't you use a shorthand require('promise.prototype.finally').shim(); if you don't like it that way, otherwise you have to require('es6-shim');

    0 讨论(0)
  • 2021-01-18 07:08

    FYI https://github.com/axios/axios/issues/34#issuecomment-558869934 Axios supports .finally().

    0 讨论(0)
提交回复
热议问题