mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Improve sync behaviour
This commit is contained in:
parent
b477a9dddd
commit
43676179dc
|
@ -28,7 +28,7 @@ export function useApi(userService: UserService, botId: string) {
|
||||||
(err) => {
|
(err) => {
|
||||||
// console.log(err);
|
// console.log(err);
|
||||||
if (err.response && err.response.status === 401) {
|
if (err.response && err.response.status === 401) {
|
||||||
console.log('Dispatching refresh_token...');
|
console.log('Fetching refresh_token...');
|
||||||
return userService
|
return userService
|
||||||
.refreshToken()
|
.refreshToken()
|
||||||
.then((token) => {
|
.then((token) => {
|
||||||
|
|
|
@ -184,17 +184,13 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
rename(name: string) {
|
rename(name: string) {
|
||||||
userService.renameBot(name);
|
userService.renameBot(name);
|
||||||
},
|
},
|
||||||
setRefreshRequired(refreshRequired: boolean) {
|
|
||||||
this.refreshRequired = refreshRequired;
|
|
||||||
},
|
|
||||||
setAutoRefresh(newRefreshValue) {
|
setAutoRefresh(newRefreshValue) {
|
||||||
this.autoRefresh = newRefreshValue;
|
this.autoRefresh = newRefreshValue;
|
||||||
// TODO: Investigate this -
|
// TODO: Investigate this -
|
||||||
// this ONLY works if ReloadControl is only visible once,otherwise it triggers twice
|
// this ONLY works if ReloadControl is only visible once,otherwise it triggers twice
|
||||||
if (newRefreshValue) {
|
if (newRefreshValue) {
|
||||||
// dispatch('startRefresh', true);
|
this.refreshFrequent();
|
||||||
} else {
|
this.refreshSlow(true);
|
||||||
// dispatch('stopRefresh');
|
|
||||||
}
|
}
|
||||||
userService.setAutoRefresh(newRefreshValue);
|
userService.setAutoRefresh(newRefreshValue);
|
||||||
},
|
},
|
||||||
|
@ -274,6 +270,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
trades = trades.concat(result.trades);
|
trades = trades.concat(result.trades);
|
||||||
totalTrades = res.data.total_trades;
|
totalTrades = res.data.total_trades;
|
||||||
} while (trades.length !== totalTrades);
|
} while (trades.length !== totalTrades);
|
||||||
|
}
|
||||||
const tradesCount = trades.length;
|
const tradesCount = trades.length;
|
||||||
// Add botId to all trades
|
// Add botId to all trades
|
||||||
trades = trades.map((t) => ({
|
trades = trades.map((t) => ({
|
||||||
|
@ -284,7 +281,6 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
}));
|
}));
|
||||||
this.trades = trades;
|
this.trades = trades;
|
||||||
this.tradeCount = tradesCount;
|
this.tradeCount = tradesCount;
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -309,7 +305,8 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
) {
|
) {
|
||||||
// Open trades changed, so we should refresh now.
|
// Open trades changed, so we should refresh now.
|
||||||
this.refreshRequired = true;
|
this.refreshRequired = true;
|
||||||
// dispatch('refreshSlow', null, { root: true });
|
this.refreshSlow(false);
|
||||||
|
}
|
||||||
|
|
||||||
const openTrades = result.data.map((t) => ({
|
const openTrades = result.data.map((t) => ({
|
||||||
...t,
|
...t,
|
||||||
|
@ -318,9 +315,6 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
botTradeId: `${botId}__${t.trade_id}`,
|
botTradeId: `${botId}__${t.trade_id}`,
|
||||||
}));
|
}));
|
||||||
this.openTrades = openTrades;
|
this.openTrades = openTrades;
|
||||||
} else {
|
|
||||||
this.openTrades = [];
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
},
|
},
|
||||||
|
|
|
@ -172,7 +172,6 @@ export const useBotStore = defineStore('wrapper', {
|
||||||
delete this.availableBots[botId];
|
delete this.availableBots[botId];
|
||||||
this.botStores = { ...this.botStores };
|
this.botStores = { ...this.botStores };
|
||||||
this.availableBots = { ...this.availableBots };
|
this.availableBots = { ...this.availableBots };
|
||||||
// commit('removeBot', botId);
|
|
||||||
} else {
|
} else {
|
||||||
console.warn(`bot ${botId} not found! could not remove`);
|
console.warn(`bot ${botId} not found! could not remove`);
|
||||||
}
|
}
|
||||||
|
@ -314,4 +313,5 @@ export function initBots() {
|
||||||
botStore.addBot(v);
|
botStore.addBot(v);
|
||||||
});
|
});
|
||||||
botStore.selectFirstBot();
|
botStore.selectFirstBot();
|
||||||
|
botStore.startRefresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ export const useSettingsStore = defineStore('uiSettings', {
|
||||||
const result = await axios.get<UiVersion>('/ui_version');
|
const result = await axios.get<UiVersion>('/ui_version');
|
||||||
const { version } = result.data;
|
const { version } = result.data;
|
||||||
this.uiVersion = version;
|
this.uiVersion = version;
|
||||||
// commit('setUIVersion', version);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user