Add method for delete property account

This commit is contained in:
DwCay
2022-07-04 18:02:34 +03:00
parent 0f455f126d
commit e44dfee284
4 changed files with 39 additions and 17 deletions

View File

@@ -17,23 +17,42 @@ class Store {
this.fetchNodeInfo()
reaction(() => this.tokenKey, () => fetchWrapper.getAuth('http://3.125.47.101/api/data/account', {
reaction(() => this.tokenKey, () => fetchWrapper.getAuth('http://3.125.47.101/api/data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}).then((res) => this.userDataFetchChange(res)))
};
fetchCreateNewAccount() {
fetchWrapper.postAuth('http://3.125.47.101/api/data/account', {
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}, [...this.encryptAccountData]).catch(()=>{})
};
fetchNewAccountData() {
fetchWrapper.getAuth('http://3.125.47.101/api/data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}).then((res) => this.userDataFetchChange(res))
}
fetchChangeAccountData(data) {
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}, [...data])
.then(()=>this.fetchNewAccountData())
}
userDataFetchChange(res) {
this._userData = res;
}
get userData() {
return this._userData
}
savePassPhrase(phrase) {
this._passPhrase = phrase
}
@@ -56,10 +75,6 @@ class Store {
console.log(err)
}
get userData() {
return this._userData;
}
get passPhrase() {
return 'rocket north inform swift improve fringe sweet crew client canyon bean autumn'
}

View File

@@ -11,7 +11,7 @@ const labelMap = {
nationality: "Nationality",
national_id: "National id",
national_doctype: "National doctype",
national_doc_id: "National doc id",
national_doc_id: "National doc id",
national_doc_issue_date: "National doc issue date",
national_doc_expiry_date: "National doc expiry date",
telephone: "Telephone",
@@ -40,14 +40,14 @@ class UserDataStore{
this._data = data.data;
})
}
get decryptedData(){
return this._data.map((elem) => ({
...elem,
key: elem.label,
label: labelMap[elem.label],
value: cryptography.decryptMessageWithPassphrase(elem.value, elem.value_nonce, registrationStore.passPhrase, registrationStore.pubKey).split(':')[1]
}))
}
}
export const userDataStore = new UserDataStore();
export const userDataStore = new UserDataStore();