Form problem with url in button

Hi!
Currently, I have built a website that collects data from two input fields and returns them in the link after pressing the button

I wanted to expand the functionality of my solution, but unfortunately the button does not respond - it does not activate the link

import wixLocation from 'wix-location'; 
$w.onReady(function() {
  const input1 = $w('#input1');
  const input2 = $w('#input2');
  const btn1 = $w('#button1');
  btn1.onClick(() => {
   if(!input1.value && !input2.value) return; wixLocation.to(`https://m. me/22aw0?ref=polec-przyjaciela--${input1.value}-${input2.value}`);
  })
}); 

Thank you very much everyone for your help :blush:

Try out

import wixLocation from 'wix-location'; 

$w.onReady(function() {
  const input1 = $w('#input1');
  const input2 = $w('#input2');
  const btn1 = $w('#button1');

  btn1.onClick(() => {
    const input1Value = input1.value;
    const input2Value = input2.value;

    if (!input1Value || !input2Value) {
      return;
    }

    const url = `https://m.me/22aw0?ref=polec-przyjaciela--${input1Value}-${input2Value}`;
    wixLocation.to(url);
  });
});