Hello.
Does anyone know what am I doing wrong with this code?
import wixData from 'wix-data'
import {session} from 'wix-storage'
import wixLocation from 'wix-location'
$w.onReady(function () {
});
export function btnLog_click(event) {
let user = $w("#emailLog").value
let pass = $w("#passLog").value
wixData.query("user-db")
.eq("email", user)
.find()
.then((resultado)=>{
console.log(resultado)
if(resultado.items.length > 0){
if(resultado.items[0].senha === pass){
session.setItem("userID", resultado.items[0]._id)
wixLocation.to("/home")
}
}
})
}
This is a simple custom login form, with all the fields matching with their own IDs.
I set that console.log to give me some tips, but I didn’t get success reading it.
This is the log when I try to log in with a email that exists in my collection:
Thanks!