Skip to content

Commit

Permalink
refactor(LoginForm): missing i18n translate options
Browse files Browse the repository at this point in the history
  • Loading branch information
bludnic committed Aug 16, 2024
1 parent 0abf18a commit 43dd79f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/components/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<script>
import { validateMnemonic } from 'bip39'
import { computed, ref, defineComponent } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
import { isAxiosError } from 'axios'
Expand All @@ -70,6 +71,7 @@ export default defineComponent({
setup(props, { emit }) {
const router = useRouter()
const store = useStore()
const { t } = useI18n()
const showSpinner = ref(false)
const showPassphrase = ref(false)
Expand Down Expand Up @@ -103,14 +105,14 @@ export default defineComponent({
})
.catch((err) => {
if (isAxiosError(err)) {
emit('error', 'login.invalid_passphrase')
emit('error', t('login.invalid_passphrase'))
} else if (isAllNodesOfflineError(err)) {
emit('error', 'errors.all_nodes_offline')
emit('error', t('errors.all_nodes_offline', { crypto: err.nodeLabel.toUpperCase() }))
} else if (isAllNodesDisabledError(err)) {
emit('error', 'errors.all_nodes_disabled')
emit('error', t('errors.all_nodes_disabled', { crypto: err.nodeLabel.toUpperCase() }))
router.push({ name: 'Nodes' })
} else {
emit('error', 'errors.something_went_wrong')
emit('error', t('errors.something_went_wrong'))
}
console.log(err)
})
Expand Down
4 changes: 2 additions & 2 deletions src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ export default defineComponent({
navigateByURI()
}
const onLoginError = (key) => {
const onLoginError = (errorMessage) => {
store.dispatch('snackbar/show', {
message: t(key),
message: errorMessage,
timeout: 3000
})
}
Expand Down

0 comments on commit 43dd79f

Please sign in to comment.