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