This commit is contained in:
2022-03-24 23:00:39 +00:00
parent cc67129bba
commit 4b7fb30a43

View File

@@ -120,13 +120,20 @@ export default {
console.log("Done parse json"); console.log("Done parse json");
} }
console.log("The processed data is ", dat); console.log(
"The processed data before cleaning is ",
JSON.stringify(dat)
);
//strip out any unsupported fields before transmission //strip out any unsupported fields before transmission
cleanData(dat, this.ayaType); cleanData(dat, this.ayaType);
console.log(
"The processed data AFTER cleaning is ",
JSON.stringify(dat)
);
//upload the data //upload the data
await this.upload(dat); //await this.upload(dat);
} catch (error) { } catch (error) {
window.$gz.errorHandler.handleFormError(error); window.$gz.errorHandler.handleFormError(error);
} }
@@ -313,6 +320,19 @@ function cleanData(dat, atype) {
]); ]);
break; break;
} }
//Strip out any records that have fields not on our allowed list
dat.forEach(z => {
for (const prop in z) {
if (allowedProps.includes(prop) == false) {
console.log(`removing unknown property z.${prop}`);
delete z[prop];
} else {
console.log(`Keeping known property z.${prop}`);
}
//console.log(`z.${prop} = ${z[prop]}`);
}
});
} }
/* HOW TO GET PROPERTY NAMES EASILY /* HOW TO GET PROPERTY NAMES EASILY