Code works in preview but not in live site

When running this code in preview it works fine, but in the live site nothing happens. I’ve checked collections are synced & everything is saved before publish - can’t see why it wouldn’t work in the live site?

export function emailCheck_click(event) {
 let enteredEmail = $w("#emailtoVerify").value;
 let formattedEmail = (enteredEmail).toLowerCase();

        wixData.query("regClients")
        .eq("registerEmail", (formattedEmail))
        .find()
        .then((results) => {
 	if(results.items.length > 0) {
            $w("#verifyError").expand();
            }
            else {
            $w("#registerForm").expand();
            }
    })
}

Try this hack:
Click on SAVE button which is near by preview.
And then publish again.

Make sure that you have the correct collection permissions .

All the collection permissions are set to Admin only (as it’s a dashboard page). There is only one item in the collection, and it has been synced to live. Unless there’s something else I’ve missed, in live nothing happens at all.

Here is all of the code. Maybe someone will see something that could help …

import wixData from "wix-data";

$w.onReady(function () {
 
});

export function emailCheck_click(event) {
 let toverifyEmail = $w("#emailtoVerify").value;
 let verificationEmail = (toverifyEmail).toLowerCase();

        wixData.query("regClients")
        .eq("registerEmail", (verificationEmail))
        .find()
        .then((results) => {
 if(results.items.length > 0) {
                $w("#verifyError").expand();
            }
 else {
            $w("#registerForm").expand();
            }
    })
    .catch( (err) => {
 let errorMsg = err;
    });
}