frequi_origin/src/store/index.ts

51 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-05-18 18:49:30 +00:00
import Vue from 'vue';
import Vuex from 'vuex';
2020-05-04 04:31:12 +00:00
2020-05-04 18:58:41 +00:00
import ftbotModule from './modules/ftbot';
2020-05-06 19:24:12 +00:00
import userModule from './modules/user';
2020-05-11 18:22:23 +00:00
import alertsModule from './modules/alerts';
2020-05-04 18:34:59 +00:00
2020-05-18 18:49:30 +00:00
Vue.use(Vuex);
2020-05-04 04:31:12 +00:00
export default new Vuex.Store({
2020-06-20 04:44:57 +00:00
state: {
ping: ''
},
2020-05-04 05:28:53 +00:00
modules: {
2020-05-06 19:24:12 +00:00
ftbot: ftbotModule,
user: userModule,
2020-05-11 18:22:23 +00:00
alerts: alertsModule,
2020-05-04 05:28:53 +00:00
},
2020-05-04 04:31:12 +00:00
mutations: {
2020-05-04 18:34:59 +00:00
setPing(state, ping) {
2020-06-20 04:44:57 +00:00
// console.log(ping);
const now = Date.now();
2020-05-18 18:49:30 +00:00
state.ping = `${ping.status} ${now.toString()}`;
},
2020-05-04 04:31:12 +00:00
},
actions: {
2020-05-25 18:41:17 +00:00
refreshOnce({ dispatch }) {
dispatch('ftbot/getVersion');
},
2020-05-18 18:49:30 +00:00
refreshAll({ dispatch }) {
dispatch('refreshFrequent');
dispatch('refreshSlow');
2020-05-17 18:43:19 +00:00
dispatch('ftbot/getDaily');
dispatch('ftbot/getBalance');
},
refreshSlow({ dispatch }) {
2020-05-17 18:43:19 +00:00
// dispatch('ftbot/getDaily');
dispatch('ftbot/getPerformance');
dispatch('ftbot/getProfit');
},
2020-05-18 18:49:30 +00:00
refreshFrequent({ dispatch }) {
2020-05-04 18:56:11 +00:00
// Refresh all data
dispatch('ftbot/getOpentrades');
2020-05-17 18:43:19 +00:00
dispatch('ftbot/getState');
2020-05-04 18:58:41 +00:00
dispatch('ftbot/getTrades');
2020-05-12 05:07:53 +00:00
dispatch('ftbot/getWhitelist');
dispatch('ftbot/getBlacklist');
},
2020-05-18 18:49:30 +00:00
},
});