Redirect on new member signup

Hi Tal,

I have this code that is not working:

import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';

export function button1_click(event, $w) {

 let userId;
 let userEmail;

 // prompt the user to log in 
        wixUsers.promptLogin({ "mode": "login" })
            .then((user) => {
                userId = user.id;
 return user.getEmail();
            })
            .then((email) => {
 // check if there is an item for the user in the collection
                userEmail = email;
 return wixData.query("Company")
                    .eq("_id", userId)
                    .find();
            })
            .then((results) => {
 // if an item for the user is not found
 if (results.items.length === 0) {
 // create an item
 const toInsert = {
 "_id": userId,
 "email": userEmail
                    };
 // add the item to the collection
                    wixData.insert("Company", toInsert)
                        .catch((err) => {
                            console.log(err);
                        });

                }
 // update buttons accordingly
                $w("#login").collapse();
                $w("#profileimage").expand();
            })
            .catch((err) => {
                console.log(err);
            });
    wixLocation.to(`/confirm`);
    }

I can’t redirect the user on their first log in either… So everytime they log in they would be redirected to that page…