Code assistance with page redirect when text field is null, please.

I have a page for site members only but I need to have their first and last names in addition to the required email address. Below is the code (snippet), in blue, to verify they are logged in and retrieve this information. It works as expected if the site member has already entered a first and last name in their profile but if those columns are null, it will not redirect them to the account page. Will someone please help me figure this out?

Thank you in advance!

/*****************************************************************************
/* Execute the code */
$w.onReady(() => {

  //Get the userInfo...
  let user = wixUsers.currentUser;
  console.log("user = ",user);
  userId = user.id;           // "r5cme-6fem-485j-djre-4844c49"
  isLoggedIn = user.loggedIn; // true
  
  user.getEmail()
    .then( (email) => {
    userEmail = email;      // "user@something.com",
    console.log(userEmail);
  } );

  //Get their login info to store in cart
    if (isLoggedIn) {
      //Get the users name
      console.log("Query Members");
      wixData.query("Members/PrivateMembersData")
        .eq("_id", userId)
        .find()
        .then((results) => {
          let items = results.items;
          console.log("Members.results.items", items);
          firstName = items[0].firstName;
          lastName = items[0].lastName;
          console.log("firstName = ",firstName); //yep, I see it
          console.log("lastName = ",lastName);  //yep, I see it
  
          //If we know their first name, continue...
          if(items.firstName !== null) {
            console.log("found name: " + firstName);
            $w("#columnStrip1").expand();
            $w("#txtDisplayName").value = firstName;
          }
          //else, redirect them to the member account page to complete..
          else
          {
            console.log("firstName is null");
            $w("#columnStrip1").collapse(); //do not show the strip
            wixLocation.to("/account/my-account"); //send them to set up
            
          } // end the if firstName not null
          
        }) // close query/then

...

  }  //end ifLoggedIn
}); //close onReady

Why not just create your own custom sign up and login lightboxes and then on your sign up lightbox you can simply capture the normal user inputs of email and password as well as first and last name.

That way you won’t need to have conditional code as it will already be filled out when they signed up to your website.

I may have to look into that. I was hoping to use some of the built in permissions associated with the Wix Members app in an attempt at quicker development time.