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