Skip to content

Commit b22cce2

Browse files
authored
Merge pull request #48 from hypersign-protocol/bug/fix
handled the credit error
2 parents 3d682b2 + 47e762d commit b22cce2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/store/mainStore.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,9 @@ const mainStore = {
13451345
.then(response => response.json())
13461346
.then(json => {
13471347
if (json) {
1348+
if (json.error) {
1349+
reject(new Error(json.message[0]))
1350+
}
13481351
if (json.data.length > 0) {
13491352
const payload = json.data.map(x => {
13501353
return {
@@ -1362,7 +1365,8 @@ const mainStore = {
13621365
}
13631366

13641367
resolve(json.data)
1365-
} else {
1368+
}
1369+
else {
13661370
resolve([])
13671371
commit('setDIDList', [])
13681372
}
@@ -1415,13 +1419,12 @@ const mainStore = {
14151419
.then(json => {
14161420

14171421
if (json) {
1418-
1419-
1420-
1422+
if (json.error) {
1423+
reject(new Error(json.message[0]))
1424+
}
14211425
resolve(json.didDocument)
1422-
14231426
} else {
1424-
reject(new Error('Could not resovle'))
1427+
reject(new Error('Could not resolve'))
14251428
}
14261429

14271430
}).catch(e => {
@@ -1466,6 +1469,9 @@ const mainStore = {
14661469
.then(response => response.json())
14671470
.then(json => {
14681471
if (json) {
1472+
if (json.error) {
1473+
reject(new Error(json.message[0]))
1474+
}
14691475
const data = {
14701476
did: payload,
14711477
didDocument: json.didDocument,
@@ -1507,6 +1513,9 @@ const mainStore = {
15071513
})
15081514
.then(response => response.json())
15091515
.then(async json => {
1516+
if (json.error) {
1517+
reject(new Error(json.message[0]))
1518+
}
15101519
if (json && json.did) {
15111520
commit('insertDIDList', {
15121521
did: json.did,

0 commit comments

Comments
 (0)