Linking A Button To Dynamic Page Through Code

Hi everyone,
The following is my code and is not working properly. Kindly (can you) point out the mistake …

export function button1_click(event) {

let user = wixUsers.currentUser;
let userId = user.id;           
console.log(userId);
wixData.query("UserProfileData")
  .eq("userId", userId)
  .find()
  .then( (results) => {
 if(results.items.length > 0) {
 let items1 =  results.items.userId;
 let id = `${items1}`
 

     wixLocation.to(`/userprofiledata/ + id`);

     } else {

      console.log("nothing");

    }

  } )
      .catch( (error) => {

 let errorMsg = error.message;

 let code = error.code;
    console.log(errorMsg);
    console.log(code);

  } );
 

 
}

Here

Thanks,
Ajith