Issue Within Wix Code

Hi
We are working on a custom Login Form & using wixuser.login and wixuser.register APIs. But when we call wixuser.register, it shows this error.
POST https://rashidsengg.wixsite.com/api/wix-sm/v1/auth/register 500 (Server Error)
Uncaught (in promise) Internal Server Error (500)
When we call wixuser.login, it shows this error.
{status: undefined, responseText: undefined}
Could you please help & support for me to resolve this issue.
Thank You.

Both of these API calls return a Promise. See the article Wix Code: Working with Promises to see how to properly handle API calls that return a Promise.

Hi Yisrael!
Thank you so much for quick response.
I checked that promises but i didn’t get solution. I paste my code here. Could you please make it usable for me?
Thanks in advance.

import wixUsers from ‘wix-users’;

$w.onReady( function () {
// Register System
$w(‘#register’).onClick( function () {
let registeremail = $w(‘#registeremail’).value; // the user’s email addresses
let registerpassword = $w(‘#registerpassword’).value; // the user’s password

wixUsers.register(registeremail, registerpassword) 
  .then((result) => { 

let status = result.status; // “Pending”
let approvalToken = result.approvalToken;
let user = result.user;
console.log(status + " : " + user + " : " + approvalToken);
});
})
// Login system
$w(‘#slogin’).onClick( function () {
let email = $w(“#email”).value;
let password = $w(“#password”).value;

wixUsers.login(email, password) 
  .then(() => { 
    console.log("User is logged in"); 
  }) 
  . **catch** ((err) => { 
    console.log(err); 
  }); 

});
});

What is #register, #registeremail, #slogin, etc?

Please post the editor URL of your site. Only authorized Wix personnel can get access to your site in the editor. Please include the name of the page involved.

I created sample Login and registration forms on homepage. If it works as i want then i will transfer to lightbox.

hello guys, do you have an update on this issue? can you share some information please :slight_smile:
thanks in advance.