mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 02:33:51 +00:00
Make updateBot method more dynamic, allowing for random updates
This commit is contained in:
parent
8570aed525
commit
6aeb3755b2
|
@ -1,6 +1,13 @@
|
|||
import axios, { AxiosResponse } from 'axios';
|
||||
|
||||
import { AuthPayload, AuthResponse, BotDescriptors, AuthStorage, AuthStorageMulti } from '@/types';
|
||||
import {
|
||||
AuthPayload,
|
||||
AuthResponse,
|
||||
BotDescriptors,
|
||||
AuthStorage,
|
||||
AuthStorageMulti,
|
||||
BotDescriptor,
|
||||
} from '@/types';
|
||||
|
||||
const AUTH_LOGIN_INFO = 'ftAuthLoginInfo';
|
||||
const APIBASE = '/api/v1';
|
||||
|
@ -13,9 +20,11 @@ export class UserService {
|
|||
this.botId = botId;
|
||||
}
|
||||
|
||||
public renameBot(newName: string): void {
|
||||
public updateBot(newName: Partial<BotDescriptor>): void {
|
||||
const newInfo = this.getLoginInfo();
|
||||
newInfo.botName = newName;
|
||||
|
||||
Object.assign(newInfo, newName);
|
||||
|
||||
this.storeLoginInfo(newInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import {
|
|||
ForceEnterPayload,
|
||||
TradeResponse,
|
||||
ClosedTrade,
|
||||
BotDescriptor,
|
||||
} from '@/types';
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
import { defineStore } from 'pinia';
|
||||
|
@ -175,8 +176,8 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
getLoginInfo() {
|
||||
return userService.getLoginInfo();
|
||||
},
|
||||
rename(name: string) {
|
||||
userService.renameBot(name);
|
||||
updateBot(updatedBotInfo: Partial<BotDescriptor>) {
|
||||
userService.updateBot(updatedBotInfo);
|
||||
},
|
||||
setAutoRefresh(newRefreshValue) {
|
||||
this.autoRefresh = newRefreshValue;
|
||||
|
|
|
@ -175,7 +175,7 @@ export const useBotStore = defineStore('ftbot-wrapper', {
|
|||
console.error('Bot not found');
|
||||
return;
|
||||
}
|
||||
this.botStores[bot.botId].rename(bot.botName);
|
||||
this.botStores[bot.botId].updateBot({ botName: bot.botName });
|
||||
this.availableBots[bot.botId].botName = bot.botName;
|
||||
},
|
||||
removeBot(botId: string) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user