Member Login/Sign Up - Redirect Function; Wix Code : Help Please

So… I currently have implemented the code provided by Wix to have a loading screen load on my site; this works well… but now I need to include the following functions via code to my site:-

I want to have members that sign up or login redirected to the member dashboard which is the members only page.

On other forums found on google, the instruction was to use -

  1. Wix Code : OnLogin | for function 1
  2. And then add Wix Code : to() | for function 2

I am not a professional developer and don’t fully understand code 100%, but I do get the basics. I have tried placing both sets of code provided by Wix as seen with attached photos, but it is simply not functioning as I need.

Can someone provide step by step instructions on how to add/join this code to make the function - Redirect on Member Login/Sign Up.

Is this even the correct code/s for the function?

Any help is greatly appreciated.


But now… How do I add / join the following two sets of code to redirect on member login/sign up?

Why not just direct them from when they login or signup from your custom lightbox?

This works perfectly and closes after registering details before moving on to signup stauts page, then both names will be saved in contacts and once site member is approved the member details will be added to ‘members’ database.

Register/Signup Lightbox Code:

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
    
    $w("#registerButton").onClick( (event) => {
        
   let email = $w("#email").value;
   let password = $w("#password").value;
   let first = $w("#firstName").value;
   let last = $w("#lastName").value;

   wixUsers.register(email, password, {
       contactInfo: {
        "firstName": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )
      .then( (result) => {
        let resultStatus = result.status;
  wixWindow.lightbox.close();
  wixLocation.to("/sign-in-status");  //Change the URL ending to whatever page you want to send the user to after they log in.
      } );     
    } );
    
});

Login Lightbox Code:

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';

$w.onReady(function () {
 $w("#forgotPassword").onClick( (event) => {
    //wixWindow.lightbox.close()
   wixUsers.promptForgotPassword()
   .then( ( ) => {
   //
   } )
    .catch( (err) => {
 let errorMsg = err;  //"The user closed the forgot password dialog"
    });
 });
});

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("/account/my-account");  //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").expand();  // 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.
   } ); 
}

Thank you soooo much! Let me try this out… I will let you know the outcome. Thanks again!