Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IvayloPapazov committed Sep 23, 2020
1 parent e392aab commit e999185
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ export default {
setInterval(() => this.reloadData(), 120 * 1000);
this.$watch(() => this.backendError, (backendError) => {
if (backendError) {
this.$router.name !== 'maintenance' && this.$router.push({
if (backendError && this.$route.name !== 'maintenance') {
this.$router.push({
name: 'maintenance',
}).catch((err) => {
console.log(err);
});
this.$store.commit('backendError', false);
}
})
this.$store.commit('backendError', false);
});
await this.initialLoad();
},
Expand Down
1 change: 1 addition & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import mutations from './mutations';
import backend from './modules/backend';
import persistState from './plugins/persistState';
import modals from './plugins/modals';
/* eslint import/no-cycle: [2, { maxDepth: 1 }] */
import Backend from '../utils/backend';

Vue.use(Vuex);
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/backend.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint no-param-reassign: ["error", { "ignorePropertyModificationsFor": ["state"] }] */
import Vue from 'vue';
import { times } from 'lodash-es';
/* eslint import/no-cycle: [2, { maxDepth: 1 }] */
import Backend from '../../utils/backend';

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
state.pinnedItems = pinnedItems;
},
reloading(state, reloading) {
state.reloading = reloading
state.reloading = reloading;
},
backendError(state, backendError) {
state.backendError = backendError;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/aeternity.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export const initClient = async () => {
}
store.commit('setSdk', client);
} catch (err) {
this.$store.commit('backendError', true);
store.commit('backendError', true);
return;
}
this.$store.commit('backendLive', true);
store.commit('backendLive', true);
};

export const scanForWallets = async () => {
Expand Down
1 change: 1 addition & 0 deletions src/utils/backend.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BACKEND_URL } from '../config/constants';
/* eslint import/no-cycle: [2, { maxDepth: 1 }] */
import { wrapTry } from './util';

const backendFetch = (path, ...args) => wrapTry(
Expand Down
8 changes: 5 additions & 3 deletions src/utils/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { get } from 'lodash-es';
import BigNumber from 'bignumber.js';
import i18n from './i18nHelper';
/* eslint import/no-cycle: [2, { maxDepth: 1 }] */
import store from '../store';

const atomsToAe = (atoms) => (new BigNumber(atoms)).dividedBy(new BigNumber(1000000000000000000));
const aeToAtoms = (ae) => (new BigNumber(ae)).times(new BigNumber(1000000000000000000));
Expand All @@ -9,10 +11,10 @@ export const wrapTry = async (promise) => {
return Promise.race([
promise.then((res) => {
if (!res) {
this.$store.commit('backendError', true);
store.commit('backendError', true);
return null;
}
this.$store.commit('backendLive', true);
store.commit('backendLive', true);
if (!res.ok) throw new Error(`Request failed with ${res.status}`);
return res.json();
}).catch((error) => {
Expand All @@ -24,7 +26,7 @@ export const wrapTry = async (promise) => {
})),
]);
} catch (err) {
this.$store.commit('backendError', true);
store.commit('backendError', true);
return null;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/views/Maintenance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default {
this.$store.commit('backendLive', false);
}
})
});
},
};
</script>
Expand Down

1 comment on commit e999185

@mradkov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.