rendered the data in the component

This commit is contained in:
Daria Golova
2022-07-13 14:45:17 +03:00
parent b9f795c0e4
commit 2eeb39abc9
3 changed files with 21 additions and 118 deletions

View File

@@ -1,4 +1,3 @@
import { cryptography } from "@liskhq/lisk-client";
import { makeAutoObservable, reaction } from "mobx";
import { fetchWrapper } from "../shared/fetchWrapper";
import { registrationStore } from './store';
@@ -45,32 +44,23 @@ class SharedDataStore{
}
fetchSharedData() {
this._keysArray.map((elem) => {
fetchWrapper.get(`http://3.125.47.101/api/data/shared/${elem}`).then((res) => this.changeSharedData(res));
})
this._keysArray.forEach((elem) => fetchWrapper.get(`http://3.125.47.101/api/data/shared/${elem}`).then((res) => this.changeSharedData(res)))
};
changeSharedData(incomingData) {
this._sharedData.push({
data: incomingData.data,
});
console.log(this._sharedData);
})
}
get sharedData() {
return this._sharedData;
}
get decryptedData() {
return this._sharedData.map((elem) =>
elem.data.map((item) => ({
key: item.label,
return this._sharedData.map(elem => ({
data: elem.data.map(item => ({
label: labelMap[item.label],
value: cryptography.decryptMessageWithPassphrase(item.value, item.value_nonce, registrationStore.passPhrase, registrationStore.pubKey).split(':')[1]
})
))
}
value: item.value,
}))
}));
};
}
export const sharedDataStore = new SharedDataStore();
console.log(sharedDataStore.sharedData);
export const sharedDataStore = new SharedDataStore();

View File

@@ -19,12 +19,12 @@ class Store {
this.fetchNodeInfo()
reaction(() => this.tokenKey, () => this.fetchData())
reaction(() => this.tokenKey, () => this.getData())
};
fetchData() {
getData() {
this.fetchNewAccountData();
this.fetchLinksArray();
this.fetchKeysArray();
}
fetchNewAccountData() {
@@ -42,7 +42,7 @@ class Store {
.then(()=>this.fetchNewAccountData())
}
fetchLinksArray() {
fetchKeysArray() {
fetchWrapper.getAuth('https://ccab53ea-d042-47b3-b9b4-79b913f47b3d.mock.pstmn.io/data/shared', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID