mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
refactor: simpler config.cache check
This commit is contained in:
parent
d19e1647df
commit
55f9599788
@ -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 }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user