made userDataStore

This commit is contained in:
Daria Golova
2022-06-29 18:34:42 +03:00
parent bcfc018560
commit 1c539e5255
3 changed files with 56 additions and 7 deletions

View File

@@ -10,6 +10,8 @@ class Store {
_nodeInfo = {}
_userData = {}
constructor() {
makeAutoObservable(this);
@@ -18,15 +20,18 @@ class Store {
reaction(() => this.tokenKey, () => fetchWrapper.getAuth('http://3.125.47.101/api/data/account', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}))
}).then((res) => this.userInfoFetchChange(res)))
};
fetchCreateNewAccount() {
fetchWrapper.postAuth('http://3.125.47.101/api/data/account', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}, [...this.encryptAccountData])
.catch(()=>{})
}, [...this.encryptAccountData]).catch(()=>{})
};
userInfoFetchChange(res) {
this._userData = res;
}
savePassPhrase(phrase) {
@@ -51,6 +56,10 @@ 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'
}