mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
Fix setIsBotOnline
This commit is contained in:
parent
b73c5cbaed
commit
10d13d788e
|
@ -6,7 +6,7 @@ import { UserService } from './userService';
|
|||
*/
|
||||
let globalStore;
|
||||
|
||||
export function useApi(userService: UserService) {
|
||||
export function useApi(userService: UserService, botId: string) {
|
||||
const api = axios.create({
|
||||
baseURL: userService.getBaseUrl(),
|
||||
timeout: 10000,
|
||||
|
@ -60,7 +60,7 @@ export function useApi(userService: UserService) {
|
|||
}
|
||||
if ((err.response && err.response.status === 500) || err.message === 'Network Error') {
|
||||
console.log('Bot not running...');
|
||||
globalStore.dispatch('setIsBotOnline', false);
|
||||
globalStore.dispatch(`ftbot/${botId}/setIsBotOnline`, false);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
@ -57,13 +57,6 @@ const store = new Vuex.Store({
|
|||
setLoggedIn({ commit }, loggedin: boolean) {
|
||||
commit('setLoggedIn', loggedin);
|
||||
},
|
||||
setIsBotOnline({ commit, dispatch }, isOnline) {
|
||||
commit('setIsBotOnline', isOnline);
|
||||
if (isOnline === false) {
|
||||
console.log('disabling autorun');
|
||||
dispatch('ftbot/setAutoRefresh', false);
|
||||
}
|
||||
},
|
||||
async loadUIVersion({ commit }) {
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
try {
|
||||
|
|
|
@ -133,7 +133,8 @@ export enum BotStoreActions {
|
|||
|
||||
export function createBotSubStore(botId: string) {
|
||||
const userService = useUserService(botId);
|
||||
const { api } = useApi(userService);
|
||||
const { api } = useApi(userService, botId);
|
||||
|
||||
|
||||
return {
|
||||
namespaced: true,
|
||||
|
@ -410,6 +411,9 @@ export function createBotSubStore(botId: string) {
|
|||
[BotStoreActions.setRefreshRequired]({ commit }, refreshRequired: boolean) {
|
||||
commit('updateRefreshRequired', refreshRequired);
|
||||
},
|
||||
[BotStoreActions.setIsBotOnline]({ commit }, refreshRequired: boolean) {
|
||||
commit('setIsBotOnline', refreshRequired);
|
||||
},
|
||||
[BotStoreActions.refreshOnce]({ dispatch }) {
|
||||
dispatch('getVersion');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user