Add bot name input

This commit is contained in:
Matthias 2021-08-29 13:15:41 +02:00
parent a330a39fe0
commit f346f49e60
4 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,15 @@
<template>
<div>
<form ref="form" novalidate @submit.stop.prevent="handleSubmit" @reset="handleReset">
<b-form-group label="Bot Name" label-for="name-input">
<b-form-input
id="name-input"
v-model="auth.botName"
required
placeholder="Bot Name"
@keydown.enter.native="handleOk"
></b-form-input>
</b-form-group>
<b-form-group
:state="urlState"
label="API Url"
@ -26,6 +35,7 @@
v-model="auth.username"
:state="nameState"
required
placeholder="Freqtrader"
@keydown.enter.native="handleOk"
></b-form-input>
</b-form-group>
@ -84,6 +94,7 @@ export default class Login extends Vue {
};
auth: AuthPayload = {
botName: '',
url: defaultURL,
username: '',
password: '',

View File

@ -56,6 +56,7 @@ export class UserService {
return info[this.botId];
}
return {
botName: '',
apiUrl: '',
refreshToken: '',
accessToken: '',
@ -100,6 +101,7 @@ export class UserService {
);
if (result.data.access_token && result.data.refresh_token) {
const obj: AuthStorage = {
botName: auth.botName,
apiUrl: auth.url,
accessToken: result.data.access_token || '',
refreshToken: result.data.refresh_token || '',
@ -169,6 +171,7 @@ export class UserService {
typeof accessToken === 'string'
) {
const loginInfo: AuthStorage = {
botName: '',
apiUrl,
refreshToken,
accessToken,

View File

@ -31,7 +31,7 @@ export default function createBotStore(store) {
},
[MultiBotStoreGetters.nextBotId](state: FTMultiBotState): string {
let botCount = state.availableBots.length;
while (`ftbot.${botCount}` in state.availableBots) {
while (state.availableBots.includes(`ftbot.${botCount}`)) {
botCount += 1;
}
return `ftbot.${botCount}`;

View File

@ -1,10 +1,12 @@
export interface AuthPayload {
botName: string;
url: string;
username: string;
password: string;
}
export interface AuthStorage {
botName: string;
apiUrl: string;
refreshToken: string;
accessToken: string;