From f136ca7ee7a7ff4a6b9826452d17c0480ff9484c Mon Sep 17 00:00:00 2001 From: Ivanov N Date: Mon, 4 Nov 2024 12:51:15 +0300 Subject: [PATCH] feat/update-login-scenario last tmp --- src/components/LoginForm.vue | 27 ++++----------------------- src/locales/en.json | 6 ++---- src/locales/ru.json | 6 ++---- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/components/LoginForm.vue b/src/components/LoginForm.vue index 707d2add4..fe0e7042e 100644 --- a/src/components/LoginForm.vue +++ b/src/components/LoginForm.vue @@ -89,22 +89,8 @@ export default defineComponent({ }) const isOnline = computed(() => store.getters['isOnline']) - watch(isOnline, (val) => { - emit('offline', !val) - }) - - const isAdmNodesNotActive = computed(() => { - return !store.getters['nodes/adm'].find(node => node.active) - }) - const isAdmNodesDisabled = computed(() => { - return !store.getters['nodes/adm'].find(node => node.status === 'online' || node.status === 'sync') - }) - const isCoinNodesDisabled = computed(() => { - return !store.getters['nodes/coins'].find(node => node.status !== 'disabled') - }) const submit = () => { - if (!isOnline.value) return emit('error', t('connection.offline')) if (!validateMnemonic(passphrase.value)) { return emit('error', t('login.invalid_passphrase')) } @@ -118,16 +104,11 @@ export default defineComponent({ emit('login') }) .catch((err) => { - if (isAxiosError(err)) { - emit('error', t('login.invalid_passphrase')) - } else if (isAdmNodesNotActive.value) { - emit('error', t('errors.all_adm_nodes_inactive')) - router.push({ name: 'Nodes' }) - } else if (isAdmNodesDisabled.value) { - emit('error', t('errors.all_adm_nodes_disabled')) - router.push({ name: 'Nodes' }) - } else if (isCoinNodesDisabled.value) { + if (!isOnline.value) { router.push({ name: 'Nodes' }) + return emit('error', t('connection.offline')) + } else if (isAxiosError(err)) { + emit('error', t('login.invalid_passphrase')) } else if (isAllNodesOfflineError(err)) { emit('error', t('errors.all_nodes_offline', { crypto: err.nodeLabel.toUpperCase() })) } else if (isAllNodesDisabledError(err)) { diff --git a/src/locales/en.json b/src/locales/en.json index 4115c1107..2ad537f51 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -99,10 +99,8 @@ "error": "Error", "errors": { "something_went_wrong": "Something went wrong. Check the console for details", - "all_nodes_offline": "All {crypto} nodes are offline. Try again later", - "all_nodes_disabled": "No active {crypto} nodes. Enable at least one", - "all_adm_nodes_inactive": "No active ADM nodes. Review the node list", - "all_adm_nodes_disabled": "All ADM nodes are disabled. Review the node list" + "all_nodes_offline": "No online ADM nodes. Review the node list", + "all_nodes_disabled": "No active ADM nodes. Enable at least one" }, "home": { "balance": "Balance", diff --git a/src/locales/ru.json b/src/locales/ru.json index 643bf08b1..1adfd0bc7 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -99,10 +99,8 @@ "error": "Ошибка", "errors": { "something_went_wrong": "Что-то пошло не так. Детали ошибки в консоли", - "all_nodes_offline": "Все {crypto} ноды недоступны. Попробуйте позже", - "all_nodes_disabled": "Нет активных узлов {crypto}. Включите хотя бы один", - "all_adm_nodes_inactive": "Нет активных нод ADM. Посмотрите список узлов", - "all_adm_nodes_disabled": "Нет доступных нод ADM. Посмотрите список узлов" + "all_nodes_offline": "Все ADM ноды недоступны. Посмотрите список узлов", + "all_nodes_disabled": "Нет активных ADM нод. Включите хотя бы одну" }, "home": { "balance": "Баланс",