Please explain what you mean. What are you trying to do? Share your code. What’s working and what’s not?
Boton onclick isnt in color pink as i saw it always in the past. En the (event) is colored in turquois.
@camperodi11 Is there a problem? Is the code not working?
import wixWindow from ‘wix-window’ ;
import wixUsers from ‘wix-users’ ;
import {fetch} from “wix-fetch” ;
import wixData from ‘wix-data’ ;
let ipAddress;
let ipCountry;
$w.onReady( function () {
getUserIp();
});
function getUserIp() {
fetch( 'https://extreme-ip-lookup.com/json' , {
method: 'get'
}).then((httpResponse) => {
if (httpResponse.ok) {
return httpResponse.json();
}
}).then((json) => {
ipAddress = json.query;
ipCountry = json.country;
});
}
export function btnLoginRedirect_click(event) {
wixWindow.lightbox.close( ‘Registro’ );
wixWindow.openLightbox( ‘Ingreso’ );
}
export function btnSignUp_click(event) {
$w( “#txtMessage” ).text = “Por favor espera…” ; $w( “#txtMessage” ).show();
$w( “#btnSignUp” ).disable();
let emails = ;
emails.push($w( “#iptEmailAddress” ).value);
wixUsers.register($w( “#iptEmailAddress” ).value, $w( “#iptPassword” ).value,
{
“contactInfo” : {
“firstName” : $w( “#iptFirstName” ).value,
“lastName” : $w( “#iptLastName” ).value,
“emails” : emails
}
}).then(() => {
let rand = Math.random().toString( 36 ).substr( 6 , 7 );
let hours = Math.round(Date.now() / 1000 / 60 / 60 )
let generatedId = rand.toString() + hours.toString();
let toInsert = {
“_id” : wixUsers.currentUser.id,
“emailAddress” : $w( “#iptEmailAddress” ).value,
“peopleId” : generatedId,
“firstName” : $w( “#iptFirstName” ).value,
“lastName” : $w( “#iptLastName” ).value,
“userName” : $w( “#iptUserName” ).value,
“orgFlag” : $w( “#iptOrganisation” ).checked,
“emailVerified” : “No” ,
“country” : ipCountry,
“ipAddress” : ipAddress,
“profilePicture” : “https://static.wixstatic.com/media/c37ffe_00b9e0d3382f4d37b1df401bcb63989b~mv2.png” ,
}
wixData.insert( "PeoplePeopleIdUserName" , toInsert)
.then(() => {
$w( "#txtMessage" ).text = "Cuenta creada! Ésta ventana se cerrará automáticamente" ; $w( "#txtMessage" ).show();
setTimeout(btnLoginRedirect_click, 2000 );
}). catch ((err) => {
$w( "#txtMessage" ).text = "Ha surgido un error, intenta de nuevo más tarde" ; $w( "#txtMessage" ).show();
})
})
}
This is the full code. Is a lightbox for my registration process, i cant go through it… I don know what i did wrong
I found the problem! It was the permission of the collection. Thanks anyway!!