From 9686e5245feddac01807228df3ead89986446e59 Mon Sep 17 00:00:00 2001 From: Daria Golova Date: Wed, 3 Aug 2022 11:14:47 +0300 Subject: [PATCH] changed userData to accounData --- src/pages/digitalId/ProfileId.jsx | 16 ++++++++-------- src/store/store.js | 14 ++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/pages/digitalId/ProfileId.jsx b/src/pages/digitalId/ProfileId.jsx index c8b55c6..e66ac76 100644 --- a/src/pages/digitalId/ProfileId.jsx +++ b/src/pages/digitalId/ProfileId.jsx @@ -78,7 +78,7 @@ const Profile = observer (() => { const handleSelectedItems = (selectedItems) => { setSelectedItems([...selectedItems]); - setUpdatedValues(registrationStore.decryptedUserData.filter(({ key }) => selectedItems.includes(key)) + setUpdatedValues(registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)) .map(elem => ( (!elem.seed) ? { ...elem, @@ -106,7 +106,7 @@ const Profile = observer (() => { }; const sendAddedData = () => { - const checkingAddedData = !registrationStore.decryptedUserData + const checkingAddedData = !registrationStore.decryptedAccountData .some((element) => element.label === addedValues.label) && (addedValues.seed.length === 20); if (checkingAddedData) { setAddPanelOpen(false); @@ -124,13 +124,13 @@ const Profile = observer (() => { }; const deleteDataParameters = () => { - const changeData = registrationStore.decryptedUserData.filter(item=>!selectedItems.includes(item.key)) + const changeData = registrationStore.decryptedAccountData.filter(item=>!selectedItems.includes(item.key)) registrationStore.pushAccountData(changeData); }; const changeInitialArray = () => { let newArr = []; - registrationStore.decryptedUserData.map(elem => { + registrationStore.decryptedAccountData.map(elem => { updatedValues.forEach(item => { if (elem.label === item.label) { newArr.push({ @@ -154,7 +154,7 @@ const Profile = observer (() => { const addDataParameters = () => { addedValues.key = addedValues.label.toLowerCase().split(' ').join(''); - registrationStore.pushAccountData(registrationStore.decryptedUserData.concat(addedValues)); + registrationStore.pushAccountData(registrationStore.decryptedAccountData.concat(addedValues)); }; const cancelAddPanel = () => { @@ -164,7 +164,7 @@ const Profile = observer (() => { }; const cancelUpdatePanel = () => { - setUpdatedValues(registrationStore.decryptedUserData.filter(({ key }) => selectedItems.includes(key)) + setUpdatedValues(registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)) .map(elem => ( (!elem.seed) ? { ...elem, @@ -235,7 +235,7 @@ const Profile = observer (() => { {/* Table */}
- +
{/* Left sidebar */} @@ -407,7 +407,7 @@ const Profile = observer (() => {

Summary

- {registrationStore.decryptedUserData.filter(({ key }) => selectedItems.includes(key)).map(item => ( + {registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)).map(item => ( {item.label} ))}
diff --git a/src/store/store.js b/src/store/store.js index 496582c..07aed4a 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -18,8 +18,6 @@ class Store { _nodeInfo = {} - _userData = [] - _keysArray = [] _sharedData = [] @@ -32,7 +30,7 @@ class Store { this.fetchNodeInfo() reaction(() => this.keysArray, () => this.fetchSharedData()) - onBecomeObserved(this, "decryptedUserData", () => this.fetchNewAccountData()) + onBecomeObserved(this, "decryptedAccountData", () => this.fetchNewAccountData()) onBecomeObserved(this, "sharedData", () => this.fetchKeysArray()) onBecomeUnobserved(this, "sharedData", () => this.unobservedSharedData()) onBecomeObserved(this, "transactionsInfo", () => this.fetchTransactionsInfo()) @@ -46,7 +44,7 @@ class Store { fetchWrapper.getAuth('data/private', { networkIdentifier: this.nodeInfo.networkIdentifier, lastBlockID: this.nodeInfo.lastBlockID - }).then((res) => this.userDataFetchChange(res)) + }).then((res) => this.accountDataFetchChange(res)) }) .catch((err) => this.fetchNodeInfoFailed(err)) } @@ -120,9 +118,9 @@ class Store { this._transactionsInfo = transaction.data } - userDataFetchChange(res) { + accountDataFetchChange(res) { if (res.data) { - this._userData = res.data; + this._accountData = res.data; } }; @@ -169,8 +167,8 @@ class Store { }) } - get decryptedUserData() { - return this._userData.map((elem) => ({ + get decryptedAccountData() { + return this._accountData.map((elem) => ({ ...elem, key: elem.label, label: labelMap[elem.label],