Prevent logging errors twice

This commit is contained in:
Matthias 2021-06-20 20:02:47 +02:00
parent 4f872fbf73
commit 9320d630d4
2 changed files with 11 additions and 8 deletions

View File

@ -29,7 +29,7 @@ export function init(store) {
api.interceptors.response.use(
(response) => response,
(err) => {
console.log(err);
// console.log(err);
if (err.response && err.response.status === 401) {
console.log('Dispatching refresh_token...');
return userService
@ -58,9 +58,10 @@ export function init(store) {
// maybe redirect to /login if needed !
}
if ((err.response && err.response.status === 500) || err.message === 'Network Error') {
console.log('Bot seems to be offline...');
console.log('Bot not running...');
store.dispatch('setIsBotOnline', false);
}
return new Promise((resolve, reject) => {
reject(err);
});

View File

@ -424,7 +424,7 @@ export default {
return Promise.resolve(result.data);
})
.catch((error) => {
console.error(error);
// console.error(error);
return Promise.reject(error);
});
},
@ -440,11 +440,13 @@ export default {
.then((result) => commit('updateProfit', result.data))
.catch(console.error);
},
getBalance({ commit }) {
return api
.get('/balance')
.then((result) => commit('updateBalance', result.data))
.catch(console.error);
async getBalance({ commit }) {
try {
const result = await api.get('/balance');
return commit('updateBalance', result.data);
} catch (error) {
return console.error(error);
}
},
getDaily({ commit }, payload: DailyPayload = {}) {
const { timescale = 20 } = payload;