Wix API code not working on safari

Hi, I’ve got a problem with WIX API code, and wix support asked me to post this problem here. This code was created by wix coder, it’s all working on PC but not on Safari or any macbook. The problem is that a new form submitted is not written into WixUsers database.
Could anyone help me to find out why it’s not working on macbooks ?
Thank you !!

import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;

$w.onReady( function () {

});

export function searchButton_onClick(event) {

if ($w(‘#switch1’).checked) {
console.log(“Hello1”);
wixData.query(“InstructorsRegNumbers”)
.find()
.then( (results) => {
let firstItem = results.items[0]; //see item below
let o_switch =“on”;
for ( let i = 0; i < results.items.length; i++){
if (results.items[i].title == $w(‘#unique’).value){
o_switch = “on”;
break ;
} else {
o_switch = “off”;
}
}
if (o_switch == “off”){
//Redirect to failed page.
//wixLocation.to(“https://www.youtube.com”);
$w(‘#sText’).hide();
$w(‘#fText’).show();

}  **else**  { 

let emails = ;
let unique = $w(‘#unique’).value;
let member_role = “”;
emails.push($w(‘#email’).value);
member_role = “Instructor”;
// if ($w(‘#switch1’).enabled) {
// member_role = “Instructor”;
// } else {
// member_role = “Participant”;
// }
// register as member using form data
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“name”: $w(‘#name’).value,
“unique”: unique,
“member_role”: member_role,
“emails”: emails
}
});

let toInsert = {
“email”: $w(‘#email’).value,
“unique_data_id”: unique
};

wixData.insert(“userData”, toInsert)
.then( (results3) => {
} )
. catch ( (err) => {
let errorMsg = err;
} );

wixLocation.to("https://www.i-act.co.uk/login"); 

//$w(‘#sText’).show();
//$w(‘#fText’).hide();
}
} )
. catch ( (err) => {
let errorMsg = err;
} );

} else {
console.log(“Hello”);
wixData.query(“RegNumbers”)
.find()
.then( (results2) => {

let firstItem = results2.items[0]; //see item below
let o_switch =“on”;
for ( let i = 0; i < results2.items.length; i++){
if (results2.items[i].title == $w(‘#unique’).value){
o_switch = “on”;
break ;
} else {
o_switch = “off”;
}
}
if (o_switch == “off”){
//Redirect to failed page.
//wixLocation.to(“https://www.youtube.com”);
$w(‘#sText’).hide();
$w(‘#fText’).show();

}  **else**  { 

let emails = ;
let unique = $w(‘#unique’).value;
let member_role = “”;
emails.push($w(‘#email’).value);
member_role = “Participant”;

// if ($w(‘#switch1’).enabled) {
// member_role = “Instructor”;
// } else {
// member_role = “Participant”;
// }

// register as member using form data
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“name”: $w(‘#name’).value,
“unique”: unique,
“member_role”: member_role,
“emails”: emails
}
});

let toInsert = {
“email”: $w(‘#email’).value,
“unique_data_id”: unique
};

console.log(toInsert);

wixData.insert("userData", toInsert) 
    .then( (results4) => { 
    } ) 
    . catch ( (err) => { 

let errorMsg = err;
} );

wixLocation.to("https://www.i-act.co.uk/login"); 

//$w(‘#sText’).show();
//$w(‘#fText’).hide();
}
} )
. catch ( (err) => {
let errorMsg = err;
} );
}
}

1 Like

Its not working for me too

What isn’t working for you? Explain what you are trying to do? Share your code. What works? What doesn’t?