New
This commit is contained in:
8
src/store/modules/chain.js
Normal file
8
src/store/modules/chain.js
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
getters: {},
|
||||
}
|
||||
6
src/store/modules/index.js
Normal file
6
src/store/modules/index.js
Normal 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'
|
||||
50
src/store/modules/login.js
Normal file
50
src/store/modules/login.js
Normal 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'))
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
7
src/store/modules/market.js
Normal file
7
src/store/modules/market.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
getters: {},
|
||||
}
|
||||
7
src/store/modules/network.js
Normal file
7
src/store/modules/network.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
getters: {},
|
||||
}
|
||||
7
src/store/modules/node.js
Normal file
7
src/store/modules/node.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
getters: {},
|
||||
}
|
||||
7
src/store/modules/owner.js
Normal file
7
src/store/modules/owner.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
getters: {},
|
||||
}
|
||||
Reference in New Issue
Block a user