Commit 4d4e4199 authored by δΏ‘ι‘«-King's avatar δΏ‘ι‘«-King Committed by ι™ˆεΈ…

fix: request cache if pro site (#2519)

parent 189accea
...@@ -60,15 +60,17 @@ const cachedSave = (response, hashcode) => { ...@@ -60,15 +60,17 @@ const cachedSave = (response, hashcode) => {
* Requests a URL, returning a promise. * Requests a URL, returning a promise.
* *
* @param {string} url The URL we want to request * @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" * @return {object} An object containing either "data" or "err"
*/ */
export default function request( export default function request(
url, url,
options = { option,
expirys: isAntdPro(),
}
) { ) {
const options = {
expirys: isAntdPro(),
...option,
};
/** /**
* Produce fingerprints based on url and parameters * Produce fingerprints based on url and parameters
* Maybe url has the same parameters * Maybe url has the same parameters
...@@ -104,7 +106,7 @@ export default function request( ...@@ -104,7 +106,7 @@ export default function request(
} }
} }
const expirys = options.expirys || 60; const expirys = options.expirys && 60;
// options.expirys !== false, return the cache, // options.expirys !== false, return the cache,
if (options.expirys !== false) { if (options.expirys !== false) {
const cached = sessionStorage.getItem(hashcode); const cached = sessionStorage.getItem(hashcode);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment