I had to recreate a website after my original website crashed I am doing a senior seminar project and have a custom form anyone can input credentials. I am having an error with my code that will compare the input from my custom form to a static collection.
import wixData from ‘wix-data’;
export function sIn_beforeInsert(item) {
return wixData.query('registry')
.eq('idv', item.iD)
.find()
.then(results => {
if (results.items.length > 0) {
const hotelMSData = {
fNamec: fN,
lNamec: lN,
idvc: item.iD
};
wixData.insert('HMS', hotelMSData);
}
})
.catch(err => {
console.error(err);
});
}
getting cannot read property iD of null.