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