mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
Add bot name input
This commit is contained in:
parent
a330a39fe0
commit
f346f49e60
|
@ -1,6 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<form ref="form" novalidate @submit.stop.prevent="handleSubmit" @reset="handleReset">
|
<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
|
<b-form-group
|
||||||
:state="urlState"
|
:state="urlState"
|
||||||
label="API Url"
|
label="API Url"
|
||||||
|
@ -26,6 +35,7 @@
|
||||||
v-model="auth.username"
|
v-model="auth.username"
|
||||||
:state="nameState"
|
:state="nameState"
|
||||||
required
|
required
|
||||||
|
placeholder="Freqtrader"
|
||||||
@keydown.enter.native="handleOk"
|
@keydown.enter.native="handleOk"
|
||||||
></b-form-input>
|
></b-form-input>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
|
@ -84,6 +94,7 @@ export default class Login extends Vue {
|
||||||
};
|
};
|
||||||
|
|
||||||
auth: AuthPayload = {
|
auth: AuthPayload = {
|
||||||
|
botName: '',
|
||||||
url: defaultURL,
|
url: defaultURL,
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class UserService {
|
||||||
return info[this.botId];
|
return info[this.botId];
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
botName: '',
|
||||||
apiUrl: '',
|
apiUrl: '',
|
||||||
refreshToken: '',
|
refreshToken: '',
|
||||||
accessToken: '',
|
accessToken: '',
|
||||||
|
@ -100,6 +101,7 @@ export class UserService {
|
||||||
);
|
);
|
||||||
if (result.data.access_token && result.data.refresh_token) {
|
if (result.data.access_token && result.data.refresh_token) {
|
||||||
const obj: AuthStorage = {
|
const obj: AuthStorage = {
|
||||||
|
botName: auth.botName,
|
||||||
apiUrl: auth.url,
|
apiUrl: auth.url,
|
||||||
accessToken: result.data.access_token || '',
|
accessToken: result.data.access_token || '',
|
||||||
refreshToken: result.data.refresh_token || '',
|
refreshToken: result.data.refresh_token || '',
|
||||||
|
@ -169,6 +171,7 @@ export class UserService {
|
||||||
typeof accessToken === 'string'
|
typeof accessToken === 'string'
|
||||||
) {
|
) {
|
||||||
const loginInfo: AuthStorage = {
|
const loginInfo: AuthStorage = {
|
||||||
|
botName: '',
|
||||||
apiUrl,
|
apiUrl,
|
||||||
refreshToken,
|
refreshToken,
|
||||||
accessToken,
|
accessToken,
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default function createBotStore(store) {
|
||||||
},
|
},
|
||||||
[MultiBotStoreGetters.nextBotId](state: FTMultiBotState): string {
|
[MultiBotStoreGetters.nextBotId](state: FTMultiBotState): string {
|
||||||
let botCount = state.availableBots.length;
|
let botCount = state.availableBots.length;
|
||||||
while (`ftbot.${botCount}` in state.availableBots) {
|
while (state.availableBots.includes(`ftbot.${botCount}`)) {
|
||||||
botCount += 1;
|
botCount += 1;
|
||||||
}
|
}
|
||||||
return `ftbot.${botCount}`;
|
return `ftbot.${botCount}`;
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
export interface AuthPayload {
|
export interface AuthPayload {
|
||||||
|
botName: string;
|
||||||
url: string;
|
url: string;
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthStorage {
|
export interface AuthStorage {
|
||||||
|
botName: string;
|
||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
refreshToken: string;
|
refreshToken: string;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user