This commit is contained in:
saplf
2018-09-29 21:33:23 +08:00
parent 0a2c4e30de
commit be7755c0f3
40 changed files with 936 additions and 73 deletions

View File

@@ -0,0 +1,8 @@
export default {
namespaced: true,
state: {
},
mutations: {},
actions: {},
getters: {},
}

View File

@@ -0,0 +1,6 @@
export { default as chain } from './chain'
export { default as market } from './market'
export { default as network } from './network'
export { default as node } from './node'
export { default as owner } from './owner'
export { default as login } from './login'

View File

@@ -0,0 +1,50 @@
import { ticApi } from '../../services'
import router from '../../router'
import { i18n } from '../../i18n'
import _ from 'lodash'
export default {
namespaced: true,
state: {
mnemonic: '',
errorMnemonic: '',
signing: false,
},
getters: {
inputError: state => !!state.errorMnemonic,
},
mutations: {
updateMnemonic(state, mnemonic) {
if (state.errorMnemonic) {
state.errorMnemonic = ''
}
state.mnemonic = mnemonic
},
updateError(state, error) {
state.errorMnemonic = error
},
updateSign(state, signing) {
state.signing = signing
},
},
actions: {
async login({ state, commit }) {
commit('updateSign', true)
const account = (await ticApi.secword2Account(state.mnemonic)) || {}
console.log(account)
commit('updateSign', false)
if (await ticApi.isAddress(account.address)) {
commit('updateAccount', _.omit(account, 'seckey'), { root: true })
router.push('/owner')
} else {
commit('updateError', i18n.t('login.errorMnemonic'))
}
},
},
}

View File

@@ -0,0 +1,7 @@
export default {
namespaced: true,
state: {},
mutations: {},
actions: {},
getters: {},
}

View File

@@ -0,0 +1,7 @@
export default {
namespaced: true,
state: {},
mutations: {},
actions: {},
getters: {},
}

View File

@@ -0,0 +1,7 @@
export default {
namespaced: true,
state: {},
mutations: {},
actions: {},
getters: {},
}

View File

@@ -0,0 +1,7 @@
export default {
namespaced: true,
state: {},
mutations: {},
actions: {},
getters: {},
}