Thanks in advance to anyone willing to help me. I’m a newbie with Velo.
I created a collection (“MemberInvitation”) where every item has three columns (named User, Name, and Event). Then, in the page I put a user input field (input1) and a button (button1): a user should insert its code (e.g. AN73UV) and clicking the button a new page should opens, simply adding /lunch or /dinner at the end of the wix page URL, as retrieved from the third column of the collection.
I tried with the following code but I cannot understand where I am wrong, since it does not work…
import wixLocation from 'wix-location';
import wixData from 'wix-data';
export function button1_click(event) {
wixData.query('MemberInvitations')
.eq('User', $w('#input1').value)
.find()
.then(results => {
let resultCount = results.totalCount;
if (resultCount !== 0) {
let firstItem = results.items[0];
let event = firstItem.Event;
wixLocation.to(`/${event}`);
}
});
}
Anyone who can help me?