This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* fetch api | |
* 1. 确保返回 fulfilled promise,没有rejected promise,所以也不用处理错误 | |
* 带错误的Promise<[null, data]> | |
* 正常结果的Promise<[{code: number, msg: string}]> | |
* 2. 使用了signal来处理超时情况 | |
*/ | |
// 如果是sdk项目,使用ponyfill,如果是自己的项目,使用polyfill(isomorphic-fetch) | |
import fetchPonyfill from "fetch-ponyfill"; | |
import pickBy from "lodash/pickBy"; |
OlderNewer