From c8b89e43feff024941206546045d5fe2aac9e790 Mon Sep 17 00:00:00 2001 From: Leonardo Matos Date: Wed, 10 Jul 2019 16:32:13 -0300 Subject: [PATCH] fix(request-store-api): fix handling request error --- src/methods/request-store-api.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/methods/request-store-api.js b/src/methods/request-store-api.js index 03b2ab7..add43b2 100644 --- a/src/methods/request-store-api.js +++ b/src/methods/request-store-api.js @@ -50,10 +50,11 @@ const requestStoreApi = ( }) .catch(err => { - if (baseURL === API_STORE_CACHE) { + let { response } = err + if (response && baseURL === API_STORE_CACHE) { // retry with live Store API - let { status } = err.response - if (!status || status >= 500) { + let { status } = response + if (!status || status < 100 || status >= 500) { isCacheOnline = false setTimeout(() => { isCacheOnline = true }, 30000) // resend request with same params