mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 21:15:15 +00:00
Make UrlDuplicate warning more responsive
This commit is contained in:
parent
db42816962
commit
7400e00796
|
@ -86,7 +86,7 @@
|
||||||
import { useUserService } from '@/shared/userService';
|
import { useUserService } from '@/shared/userService';
|
||||||
import { AuthPayload, AuthStorageWithBotId } from '@/types';
|
import { AuthPayload, AuthStorageWithBotId } from '@/types';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useBotStore } from '@/stores/ftbotwrapper';
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -106,7 +106,6 @@ const botStore = useBotStore();
|
||||||
const nameState = ref<boolean | ''>('');
|
const nameState = ref<boolean | ''>('');
|
||||||
const pwdState = ref<boolean | ''>('');
|
const pwdState = ref<boolean | ''>('');
|
||||||
const urlState = ref<boolean | ''>('');
|
const urlState = ref<boolean | ''>('');
|
||||||
const urlDuplicate = ref(false);
|
|
||||||
const errorMessage = ref<string>('');
|
const errorMessage = ref<string>('');
|
||||||
const errorMessageCORS = ref<boolean>(false);
|
const errorMessageCORS = ref<boolean>(false);
|
||||||
const formRef = ref<HTMLFormElement>();
|
const formRef = ref<HTMLFormElement>();
|
||||||
|
@ -122,15 +121,16 @@ const emitLoginResult = (value: boolean) => {
|
||||||
emit('loginResult', value);
|
emit('loginResult', value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const urlDuplicate = computed<boolean>(() => {
|
||||||
|
const bots = Object.values(botStore.availableBots).find((bot) => bot.botUrl === auth.value.url);
|
||||||
|
return bots !== undefined;
|
||||||
|
});
|
||||||
|
|
||||||
const checkFormValidity = () => {
|
const checkFormValidity = () => {
|
||||||
const valid = formRef.value?.checkValidity();
|
const valid = formRef.value?.checkValidity();
|
||||||
nameState.value = valid || auth.value.username !== '';
|
nameState.value = valid || auth.value.username !== '';
|
||||||
pwdState.value = valid || auth.value.password !== '';
|
pwdState.value = valid || auth.value.password !== '';
|
||||||
urlState.value = valid || auth.value.url !== '';
|
urlState.value = valid || auth.value.url !== '';
|
||||||
if (urlState.value) {
|
|
||||||
const bots = Object.values(botStore.availableBots).find((bot) => bot.botUrl === auth.value.url);
|
|
||||||
urlDuplicate.value = bots !== undefined;
|
|
||||||
}
|
|
||||||
return valid;
|
return valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,7 +142,6 @@ const resetLogin = () => {
|
||||||
nameState.value = '';
|
nameState.value = '';
|
||||||
pwdState.value = '';
|
pwdState.value = '';
|
||||||
urlState.value = '';
|
urlState.value = '';
|
||||||
urlDuplicate.value = false;
|
|
||||||
errorMessage.value = '';
|
errorMessage.value = '';
|
||||||
botEdit.value = false;
|
botEdit.value = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user