Add account disconnection on init error

This commit is contained in:
Anton Suprunchuk 2019-12-29 12:21:48 +07:00
parent 6c1dccdeb4
commit 8db5bb1728
2 changed files with 18 additions and 6 deletions

View file

@ -108,6 +108,7 @@ export default new Vuex.Store({
console.error(e); console.error(e);
commit('setError', e); commit('setError', e);
commit('setSyncing', false); commit('setSyncing', false);
demoSDK.account.disconnect();
return; return;
} }
@ -122,10 +123,11 @@ export default new Vuex.Store({
getters: { getters: {
identityLists(state) { identityLists(state) {
const { identities } = state; const { identities } = state;
return Object.keys(identityTypes).map(typeName => ({ const lists = Object.keys(identityTypes).map(typeName => ({
type: identityTypes[typeName], type: identityTypes[typeName],
items: identities[typeName], items: identities[typeName],
})); }));
return lists;
}, },
userIdentitiesWithNames(state) { userIdentitiesWithNames(state) {
const { user } = state.identities; const { user } = state.identities;
@ -141,6 +143,15 @@ export default new Vuex.Store({
contract: state.contracts[identity.id], contract: state.contracts[identity.id],
})); }));
}, },
errorDetails(state) {
return state.errorDetails;
},
isSyncing(state) {
return state.isSyncing;
},
isError(state) {
return state.isError;
},
}, },
plugins: [createPersistedState()], plugins: [createPersistedState()],
}); });

View file

@ -1,19 +1,19 @@
<template> <template>
<v-container> <v-container>
<v-row> <v-row v-show="isError">
<v-card> <v-card>
<v-card-title> <v-card-title>
Error occurred Error occurred
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
Text is here {{errorDetails ? errorDetails.message : ''}}
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-row> </v-row>
<v-row> <v-row v-show="isSyncing">
<v-card> <v-card loading="primary">
<v-card-title> <v-card-title>
Wallet is syncing Wallet is syncing
</v-card-title> </v-card-title>
@ -23,7 +23,8 @@
</v-card> </v-card>
</v-row> </v-row>
<v-row> <v-row v-show="!isSyncing && !isError">
{{identityLists}}
<v-col <v-col
v-for="list in identityLists" v-for="list in identityLists"
:key="list.type.value" :key="list.type.value"