Commit b60c5305 authored by 陈帅's avatar 陈帅

Turn off caching by default

parent 1b94c656
...@@ -2,6 +2,7 @@ import fetch from 'dva/fetch'; ...@@ -2,6 +2,7 @@ import fetch from 'dva/fetch';
import { notification } from 'antd'; import { notification } from 'antd';
import router from 'umi/router'; import router from 'umi/router';
import hash from 'hash.js'; import hash from 'hash.js';
import { isAntdPro } from './utils';
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
...@@ -62,7 +63,12 @@ const cachedSave = (response, hashcode) => { ...@@ -62,7 +63,12 @@ const cachedSave = (response, hashcode) => {
* @param {object} [options] The options we want to pass to "fetch" * @param {object} [options] 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(url, options = {}) { export default function request(
url,
options = {
expirys: isAntdPro(),
}
) {
/** /**
* 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
......
...@@ -207,3 +207,7 @@ export function formatWan(val) { ...@@ -207,3 +207,7 @@ export function formatWan(val) {
} }
return result; return result;
} }
export function isAntdPro() {
return window.location.hostname === 'preview.pro.ant.design';
}
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