I created a registration form and it works well when users register they go to their page (dynamic “id”) but now I am trying to get users to be able to log in to their site (dynamic) with (* log in ) does anyone have any idea how I can do this?
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
$w.onReady(function () {
export function loginButton_click(event) {
let email = $w("#email").value;
let password = $w("#password").value;
wixUsers.login(email, password)
.then( () => {
console.log("User is logged in");
wixLocation.to("/?"); //Change the URL ending to whatever page you want to send the user to after they log in.
} )
.catch( (err) => {
console.log(err);
$w("#errorMessage").show(); // You can delete this line if you are not going to add an error message. Use a regular text element set to 'collapse on load' from the Properties Panel.
}
);
});
});
this is a cod works well but i do not know how to do it for dynamic pages.