diff --git a/src/utils/request.js b/src/utils/request.js index ffad1ed935fd9e517dd885d1e1d9403af6ecdff4..90703f75389836ab9648166b4123faf8c0617f86 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -60,15 +60,17 @@ const cachedSave = (response, hashcode) => { * Requests a URL, returning a promise. * * @param {string} url The URL we want to request - * @param {object} [options] The options we want to pass to "fetch" + * @param {object} [option] The options we want to pass to "fetch" * @return {object} An object containing either "data" or "err" */ export default function request( url, - options = { - expirys: isAntdPro(), - } + option, ) { + const options = { + expirys: isAntdPro(), + ...option, + }; /** * Produce fingerprints based on url and parameters * Maybe url has the same parameters @@ -104,7 +106,7 @@ export default function request( } } - const expirys = options.expirys || 60; + const expirys = options.expirys && 60; // options.expirys !== false, return the cache, if (options.expirys !== false) { const cached = sessionStorage.getItem(hashcode);