changed userData to accounData

This commit is contained in:
Daria Golova
2022-08-03 11:14:47 +03:00
parent 1f306b2dce
commit 9686e5245f
2 changed files with 14 additions and 16 deletions

View File

@@ -78,7 +78,7 @@ const Profile = observer (() => {
const handleSelectedItems = (selectedItems) => { const handleSelectedItems = (selectedItems) => {
setSelectedItems([...selectedItems]); setSelectedItems([...selectedItems]);
setUpdatedValues(registrationStore.decryptedUserData.filter(({ key }) => selectedItems.includes(key)) setUpdatedValues(registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key))
.map(elem => ( .map(elem => (
(!elem.seed) ? { (!elem.seed) ? {
...elem, ...elem,
@@ -106,7 +106,7 @@ const Profile = observer (() => {
}; };
const sendAddedData = () => { const sendAddedData = () => {
const checkingAddedData = !registrationStore.decryptedUserData const checkingAddedData = !registrationStore.decryptedAccountData
.some((element) => element.label === addedValues.label) && (addedValues.seed.length === 20); .some((element) => element.label === addedValues.label) && (addedValues.seed.length === 20);
if (checkingAddedData) { if (checkingAddedData) {
setAddPanelOpen(false); setAddPanelOpen(false);
@@ -124,13 +124,13 @@ const Profile = observer (() => {
}; };
const deleteDataParameters = () => { 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); registrationStore.pushAccountData(changeData);
}; };
const changeInitialArray = () => { const changeInitialArray = () => {
let newArr = []; let newArr = [];
registrationStore.decryptedUserData.map(elem => { registrationStore.decryptedAccountData.map(elem => {
updatedValues.forEach(item => { updatedValues.forEach(item => {
if (elem.label === item.label) { if (elem.label === item.label) {
newArr.push({ newArr.push({
@@ -154,7 +154,7 @@ const Profile = observer (() => {
const addDataParameters = () => { const addDataParameters = () => {
addedValues.key = addedValues.label.toLowerCase().split(' ').join(''); addedValues.key = addedValues.label.toLowerCase().split(' ').join('');
registrationStore.pushAccountData(registrationStore.decryptedUserData.concat(addedValues)); registrationStore.pushAccountData(registrationStore.decryptedAccountData.concat(addedValues));
}; };
const cancelAddPanel = () => { const cancelAddPanel = () => {
@@ -164,7 +164,7 @@ const Profile = observer (() => {
}; };
const cancelUpdatePanel = () => { const cancelUpdatePanel = () => {
setUpdatedValues(registrationStore.decryptedUserData.filter(({ key }) => selectedItems.includes(key)) setUpdatedValues(registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key))
.map(elem => ( .map(elem => (
(!elem.seed) ? { (!elem.seed) ? {
...elem, ...elem,
@@ -235,7 +235,7 @@ const Profile = observer (() => {
</div> </div>
{/* Table */} {/* Table */}
<div className='w-[828px]'> <div className='w-[828px]'>
<ProfileTable isCheck={isCheck} handleClick={handleClick} userData={registrationStore.decryptedUserData}/> <ProfileTable isCheck={isCheck} handleClick={handleClick} userData={registrationStore.decryptedAccountData}/>
</div> </div>
</div> </div>
{/* Left sidebar */} {/* Left sidebar */}
@@ -407,7 +407,7 @@ const Profile = observer (() => {
<div className={`${!removePanelOpen && 'hidden'} bg-white px-5 pt-4 pb-[190px] shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-12`}> <div className={`${!removePanelOpen && 'hidden'} bg-white px-5 pt-4 pb-[190px] shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-12`}>
<h2 className="grow text-base font-semibold text-slate-800 truncate mb-2">Summary</h2> <h2 className="grow text-base font-semibold text-slate-800 truncate mb-2">Summary</h2>
<div className="flex flex-col"> <div className="flex flex-col">
{registrationStore.decryptedUserData.filter(({ key }) => selectedItems.includes(key)).map(item => ( {registrationStore.decryptedAccountData.filter(({ key }) => selectedItems.includes(key)).map(item => (
<span key={item.label} className="text-sm font-normal text-slate-600 py-3 border-b border-slate-200">{item.label}</span> <span key={item.label} className="text-sm font-normal text-slate-600 py-3 border-b border-slate-200">{item.label}</span>
))} ))}
</div> </div>

View File

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