Skip to content

Commit

Permalink
feat/update-login-scenario last tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivanov N committed Nov 4, 2024
1 parent bd9c0fd commit f136ca7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
27 changes: 4 additions & 23 deletions src/components/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
}
Expand All @@ -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)) {
Expand Down
6 changes: 2 additions & 4 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Баланс",
Expand Down

0 comments on commit f136ca7

Please sign in to comment.