refactor: simpler config.cache check

This commit is contained in:
arthurfiorette 2022-04-30 22:40:49 -03:00
parent d19e1647df
commit 55f9599788
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555

View File

@ -208,11 +208,12 @@ export function defaultResponseInterceptor(
const onRejected: ResponseInterceptor['onRejected'] = async (error) => { const onRejected: ResponseInterceptor['onRejected'] = async (error) => {
const config = error['config'] as CacheRequestConfig; const config = error['config'] as CacheRequestConfig;
if (!config || config.cache === false || !config.id) { // config.cache should always exists, at least from global config merge.
if (!config?.cache || !config.id) {
if (__ACI_DEV__) { if (__ACI_DEV__) {
axios.debug?.({ axios.debug?.({
msg: 'Web request returned an error but cache handling is not enabled', msg: 'Web request returned an error but cache handling is not enabled',
data: { error, config } data: { error }
}); });
} }