Merge pull request #31 from franze6/DID-6

Changing data in store to array
This commit is contained in:
DuCay
2022-07-06 19:27:56 +03:00
committed by GitHub
4 changed files with 11 additions and 9 deletions

View File

@@ -40,7 +40,12 @@ const Onboarding2 = observer(()=>{
} else { } else {
setFillingForm(true) setFillingForm(true)
} }
registrationStore.saveDataRegistration(dataRegistration) registrationStore.saveDataRegistration(Object.keys(dataRegistration).map(item=>{
return{
key: `${item}`,
value: dataRegistration[item]
}
}))
} }
useEffect(()=>{ useEffect(()=>{

View File

@@ -81,7 +81,7 @@ const Onboarding4 = observer(()=>{
<circle className="text-emerald-100" cx="32" cy="32" r="32" /> <circle className="text-emerald-100" cx="32" cy="32" r="32" />
<path className="text-emerald-500" d="m28.5 41-8-8 3-3 5 5 12-12 3 3z" /> <path className="text-emerald-500" d="m28.5 41-8-8 3-3 5 5 12-12 3 3z" />
</svg> </svg>
<h1 className="text-3xl text-slate-800 font-bold mb-8">{registrationStore.accountData.first_name ? `Nice to meet you, ${registrationStore.accountData.first_name} 🙌` : 'Please, go back step 2'}</h1> <h1 className="text-3xl text-slate-800 font-bold mb-8">{registrationStore.accountData.find(item=>item.key="first_name").key ? `Nice to meet you, ${registrationStore.accountData.find(item=>item.key="first_name").value} 🙌` : 'Please, go back step 2'}</h1>
<button onClick={()=>createAccount()} className="btn px-6 bg-indigo-500 hover:bg-indigo-600 text-white"> <button onClick={()=>createAccount()} className="btn px-6 bg-indigo-500 hover:bg-indigo-600 text-white">
<Link id="link-dashboard" to={checkBoxesSelected && "/dashboard"}>Go To Profile -&gt;</Link> <Link id="link-dashboard" to={checkBoxesSelected && "/dashboard"}>Go To Profile -&gt;</Link>
</button> </button>

View File

@@ -8,7 +8,6 @@ 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);
@@ -76,10 +75,8 @@ const Profile = observer (() => {
} }
const deletePropertyData = () => { const deletePropertyData = () => {
const newDataPush = {}
const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key)) const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key))
changeData.forEach(pushData=>newDataPush[pushData.key]=pushData.value) registrationStore.pushAccountData(changeData)
registrationStore.pushAccountData(newDataPush)
} }
const cancelAddPanel = () => { const cancelAddPanel = () => {

View File

@@ -74,10 +74,10 @@ class Store {
}; };
encryptAccountData(data) { encryptAccountData(data) {
return Object.keys(data).map((label) => { return data.map((item) => {
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') + ":" + item.value, this.passPhrase, this.pubKey);
return { return {
"label": label, "label": item.key,
"value": value.encryptedMessage, "value": value.encryptedMessage,
"value_nonce": value.nonce, "value_nonce": value.nonce,
} }