made userDataStore
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user