fix: correct errors for unreachable servers

This commit is contained in:
Ali BARIN
2023-02-27 20:28:15 +01:00
parent 329fcdf8f4
commit 61fb71a080

View File

@@ -40,8 +40,9 @@ export default function createHttpClient({
instance.interceptors.response.use(
(response) => response,
async (error) => {
const { config } = error;
const { status } = error.response;
const { config, response } = error;
// Do not destructure `status` from `error.response` because it might not exist
const status = response?.status;
if (
// TODO: provide a `shouldRefreshToken` function in the app