made sending data

This commit is contained in:
Daria Golova
2022-07-06 20:22:48 +03:00
parent 18bf373508
commit 5d17137815
3 changed files with 49 additions and 55 deletions

View File

@@ -23,7 +23,7 @@ const Profile = observer (() => {
seed: Math.floor(Math.random() * 90000000000000000000) seed: Math.floor(Math.random() * 90000000000000000000)
}; };
const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'Residence', 'Document type', 'Document ID', 'Issue date', 'Expiry date']; const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'National doctype', 'National doc id', 'National doc issue date', 'National doc expiry date'];
const [propertyValues, setPropertyValues] = useState([]); const [propertyValues, setPropertyValues] = useState([]);
const [updatedValues, setUpdatedValues] = useState([defaultValues]); const [updatedValues, setUpdatedValues] = useState([defaultValues]);
const [addedValues, setAddedValues] = useState(defaultValues); const [addedValues, setAddedValues] = useState(defaultValues);
@@ -43,7 +43,6 @@ const Profile = observer (() => {
...prevState, ...prevState,
[field]: +value, [field]: +value,
})) }))
console.log(addedValues);
}; };
const changeUpdatedValues = (value, field, key) => { const changeUpdatedValues = (value, field, key) => {
@@ -59,7 +58,6 @@ const Profile = observer (() => {
} : elem } : elem
)) ))
) )
console.log(updatedValues);
}; };
const closeHint = (element) => { const closeHint = (element) => {
@@ -113,7 +111,7 @@ const Profile = observer (() => {
const deleteDataParameters = () => { const deleteDataParameters = () => {
const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key)) const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key))
registrationStore.pushAccountData(changeData) registrationStore.pushAccountData(changeData);
} }
const changeDataParameters = () => { const changeDataParameters = () => {
@@ -135,12 +133,12 @@ const Profile = observer (() => {
}) })
return newArr return newArr
})(); })();
console.log(updatedData); registrationStore.pushAccountData(updatedData);
} }
const addDataParameters = () => { const addDataParameters = () => {
addedValues.label = addedValues.label.toLowerCase().split(' ').join('_'); addedValues.key = addedValues.label.toLowerCase().split(' ').join('_');
console.log(registrationStore.userData.data.concat(addedValues)); registrationStore.pushAccountData(userDataStore.decryptedData.concat(addedValues));
} }
const cancelAddPanel = () => { const cancelAddPanel = () => {
@@ -162,7 +160,6 @@ const Profile = observer (() => {
const openUpdatePanel = () => { const openUpdatePanel = () => {
setUpdatePanelOpen(true); setUpdatePanelOpen(true);
setChangePanelOpen(false); setChangePanelOpen(false);
console.log(updatedValues);
} }
const applyDataDeletion = () => { const applyDataDeletion = () => {
@@ -313,7 +310,6 @@ const Profile = observer (() => {
<div className={`${!updatePanelOpen && 'hidden'} bg-white p-5 shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-11`}> <div className={`${!updatePanelOpen && 'hidden'} bg-white p-5 shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-11`}>
{updatedValues.map((item, index) => ( {updatedValues.map((item, index) => (
<div key={index} className="flex flex-col gap-y-3"> <div key={index} className="flex flex-col gap-y-3">
<div> <div>
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label> <label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label>
<input <input
@@ -354,9 +350,7 @@ const Profile = observer (() => {
<div className="mt-2 mb-3.5 items-center border-b border-slate-200"></div> <div className="mt-2 mb-3.5 items-center border-b border-slate-200"></div>
) : null} ) : null}
</div> </div>
))} ))}
<div className="flex flex-row justify-between pt-[16px] pb-[23px] items-center border-b border-slate-200"> <div className="flex flex-row justify-between pt-[16px] pb-[23px] items-center border-b border-slate-200">
<span className="block text-sm font-medium">Store data on blockchain</span> <span className="block text-sm font-medium">Store data on blockchain</span>
<div className="flex items-center"> <div className="flex items-center">

View File

@@ -31,13 +31,13 @@ function ProfileTable({
const data = { const data = {
general:["First name","Second name", "Gender", "Birthdate", "Place of birth"], general:["First name","Second name", "Gender", "Birthdate", "Place of birth"],
nationality:["Nationality", "National id", "National doctype", "National doc id", "National doc issue date", "National doc expiry date"], nationality:["Nationality", "National ID", "National doctype", "National doc ID", "National doc issue date", "National doc expiry date"],
social:["Telephone", "Twitter", "Facebook", "Instagram", "Youtube", "Wechat", "Tiktok", "Linkedin", "Vk", "Github", "Telegram", "Qq", "Snapchat", "Reddit"] social:["Telephone", "Twitter", "Facebook", "Instagram", "Youtube", "Wechat", "Tiktok", "Linkedin", "Vk", "Github", "Telegram", "Qq", "Snapchat", "Reddit"]
} }
const generalData = userData.filter(elem => data.general.includes(elem.label)), const generalData = userData.filter(elem => data.general.includes(elem.label)),
nationalityData = userData.filter(elem => data.nationality.includes(elem.label)), nationalityData = userData.filter(elem => data.nationality.includes(elem.label)),
sosialData = userData.filter(elem => data.nationality.includes(elem.label)), sosialData = userData.filter(elem => data.social.includes(elem.label)),
otherData = userData.filter((elem) => otherData = userData.filter((elem) =>
!data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label)); !data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label));

View File

@@ -9,9 +9,9 @@ const labelMap = {
birthdate: "Birthdate", birthdate: "Birthdate",
place_of_birth: "Place of birth", place_of_birth: "Place of birth",
nationality: "Nationality", nationality: "Nationality",
national_id: "National id", national_id: "National ID",
national_doctype: "National doctype", national_doctype: "National doctype",
national_doc_id: "National doc id", national_doc_id: "National doc ID",
national_doc_issue_date: "National doc issue date", national_doc_issue_date: "National doc issue date",
national_doc_expiry_date: "National doc expiry date", national_doc_expiry_date: "National doc expiry date",
telephone: "Telephone", telephone: "Telephone",