As you can see from your screen shot, you have an error flagged. You are trying to use the variable firstName without declaring or setting it.
You will need to use the returned results from the database query to get the value of the firstName field. Something like this:
.then( (results) => {
if(results.items.length > 0) {
let firstItem = results.items[0]; // get the first (only?) item
let firstName = firstItem.firstName; // get the field we want
wixLocation.to(`/profile/`+ firstName)
} else {
// handle case where no matching items found
}
} )
Note that this has not been tested. The code is merely an illustration how to retrieve a specific field from an database item (row).
If you feel like you’re struggling with code, please visit the Wix Marketplace where you can find pro designers and developers to help you build your site.