Created
September 8, 2019 15:15
-
-
Save ryochin/7187763d413a0fc00c42b5cf46b249a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
axios.interceptors.request.use((config: Axios.AxiosRequestConfig) => { | |
if (_.isUndefined(typeof config.params)) { | |
config.params = {} | |
} | |
if (_.isObject(config.params)) { | |
// prevent caching on IE | |
if (_.isFunction(URLSearchParams) && config.params instanceof URLSearchParams) { | |
config.params.append('_', Date.now()) | |
} | |
else { | |
config.params._ = Date.now() | |
} | |
} | |
return config | |
}, (error: any) => { | |
return Promise.reject(error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment