@@ -14,7 +14,7 @@ const Onboarding4 = observer(()=>{
|
|||||||
if(checkBoxes.find(item=>item.checked===false)) {
|
if(checkBoxes.find(item=>item.checked===false)) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
registrationStore.pushNewAccount()
|
registrationStore.pushAccountData()
|
||||||
setCheckBoxesSelected(true)
|
setCheckBoxesSelected(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import ProfileTable from '../../partials/digitalId/ProfileTable';
|
|||||||
import Image from '../../images/transactions-image-04.svg';
|
import Image from '../../images/transactions-image-04.svg';
|
||||||
|
|
||||||
const Profile = observer (() => {
|
const Profile = observer (() => {
|
||||||
|
console.log(registrationStore.accountData)
|
||||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||||
const [buttonPanelOpen, setButtonPanelOpen] = useState(true);
|
const [buttonPanelOpen, setButtonPanelOpen] = useState(true);
|
||||||
const [removePanelOpen, setRemovePanelOpen] = useState(false);
|
const [removePanelOpen, setRemovePanelOpen] = useState(false);
|
||||||
@@ -75,8 +76,10 @@ const Profile = observer (() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deletePropertyData = () => {
|
const deletePropertyData = () => {
|
||||||
const changeData = registrationStore.userData.data.filter(item=>!selectedItems.includes(item.label))
|
const newDataPush = {}
|
||||||
registrationStore.pushAccountData(changeData)
|
const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key))
|
||||||
|
changeData.forEach(pushData=>newDataPush[pushData.key]=pushData.value)
|
||||||
|
registrationStore.pushAccountData(newDataPush)
|
||||||
}
|
}
|
||||||
|
|
||||||
const cancelAddPanel = () => {
|
const cancelAddPanel = () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {getNodeInfo} from '../api/node';
|
|||||||
import {fetchWrapper} from '../shared/fetchWrapper';
|
import {fetchWrapper} from '../shared/fetchWrapper';
|
||||||
|
|
||||||
class Store {
|
class Store {
|
||||||
_accountData = {}
|
_accountData = []
|
||||||
|
|
||||||
_passPhrase='rocket north inform swift improve fringe sweet crew client canyon bean autumn'
|
_passPhrase='rocket north inform swift improve fringe sweet crew client canyon bean autumn'
|
||||||
|
|
||||||
@@ -17,17 +17,7 @@ class Store {
|
|||||||
|
|
||||||
this.fetchNodeInfo()
|
this.fetchNodeInfo()
|
||||||
|
|
||||||
reaction(() => this.tokenKey, () => fetchWrapper.getAuth('http://3.125.47.101/api/data/private', {
|
reaction(() => this.tokenKey, () => this.fetchNewAccountData())
|
||||||
networkIdentifier: this.nodeInfo.networkIdentifier,
|
|
||||||
lastBlockID: this.nodeInfo.lastBlockID
|
|
||||||
}).then((res) => this.userDataFetchChange(res)))
|
|
||||||
};
|
|
||||||
|
|
||||||
pushNewAccount() {
|
|
||||||
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
|
|
||||||
networkIdentifier: this.nodeInfo.networkIdentifier,
|
|
||||||
lastBlockID: this.nodeInfo.lastBlockID
|
|
||||||
}, [...this.encryptAccountData]).catch(()=>{})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchNewAccountData() {
|
fetchNewAccountData() {
|
||||||
@@ -37,11 +27,11 @@ class Store {
|
|||||||
}).then((res) => this.userDataFetchChange(res))
|
}).then((res) => this.userDataFetchChange(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
pushAccountData(data) {
|
pushAccountData(data=this.accountData) {
|
||||||
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
|
fetchWrapper.postAuth('http://3.125.47.101/api/data/private', {
|
||||||
networkIdentifier: this.nodeInfo.networkIdentifier,
|
networkIdentifier: this.nodeInfo.networkIdentifier,
|
||||||
lastBlockID: this.nodeInfo.lastBlockID
|
lastBlockID: this.nodeInfo.lastBlockID
|
||||||
}, [...data])
|
}, [...this.encryptAccountData(data)])
|
||||||
.then(()=>this.fetchNewAccountData())
|
.then(()=>this.fetchNewAccountData())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +73,8 @@ class Store {
|
|||||||
return this._accountData
|
return this._accountData
|
||||||
};
|
};
|
||||||
|
|
||||||
get encryptAccountData() {
|
encryptAccountData(data) {
|
||||||
return Object.keys(this.accountData).map((label) => {
|
return Object.keys(data).map((label) => {
|
||||||
let value = cryptography.encryptMessageWithPassphrase(cryptography.getRandomBytes(32).toString('hex') + ":" + this.accountData[label], this.passPhrase, this.pubKey);
|
let value = cryptography.encryptMessageWithPassphrase(cryptography.getRandomBytes(32).toString('hex') + ":" + this.accountData[label], this.passPhrase, this.pubKey);
|
||||||
return {
|
return {
|
||||||
"label": label,
|
"label": label,
|
||||||
|
|||||||
Reference in New Issue
Block a user