Hi Rachel:
This is where promises come into play and can also be a little hard to understand.
If you look at the wix-users.promptForLogin() function (https://www.wix.com/code/reference/wix-users.html#promptLogin) you will see they return a Promise.
You can familiarize yourself with what a Promise is here (Using promises - JavaScript | MDN). Essentially because you have to wait for the registration/login to happen (it is an asynchronous operation) the login function gives you an object called a promise which operates in a similar way to a callback function. When the login/register completes then the promise completes (this is called resolving). Once this happens you can .then() do something else.
So if you add a .then() call to the promptForLogin() call you can do something else when the function completes successfully. So for example
import wixUsers from 'wix-user';
import wixWindow from 'wix-window';
// Launch Wix sign up page
wixUsers.promptForLogin({'mode':'signup'})
.then((userRecord) => {
if (userRecord) {
// We have a user Record to work with
} else {
// Tell user that there was a problem - this is likely to be that they cancelled the login screen
// By clicking the X in the top left of the screen.
// Load form to capture other user info.
wixWindow.openLightbox('additionalUserInfoForm");
}
}
.catch((error) => {
// If a problem occurs with the prompt login then it will throw and exception so you should
// catch it and report the error to the user
}