Changing data in store to array

This commit is contained in:
DwCay
2022-07-06 19:27:26 +03:00
parent f0e0d9479d
commit 2d0ae35cc8
4 changed files with 11 additions and 9 deletions

View File

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

View File

@@ -81,7 +81,7 @@ const Onboarding4 = observer(()=>{
<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" />
</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">
<Link id="link-dashboard" to={checkBoxesSelected && "/dashboard"}>Go To Profile -&gt;</Link>
</button>

View File

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