fix(frontend): log error in API middleware

This commit is contained in:
Alex Kaminskii 2022-07-27 17:18:46 +02:00
parent 3c719f4839
commit 5366f2b798

View file

@ -1,3 +1,4 @@
import logger from 'App/logger';
import APIClient from './api_client';
import { UPDATE, DELETE } from './duck/jwt';
@ -28,8 +29,9 @@ export default store => next => (action) => {
next({ type: UPDATE, data: jwt });
}
})
.catch(() => {
return next({ type: FAILURE, errors: [ 'Connection error' ] });
.catch((e) => {
logger.error("Error during API request. ", e)
return next({ type: FAILURE, errors: [ "Connection error", String(e) ] });
});
};