Boolean value of each user

Hi There,

I have a member profile page with the sign-in functionalities etc. After users have filled in the form on their dynamic page, they have to agree with the Terms and conditions by using the boolean button (‘Agree’) which is stored in the #dynamicDataset and then their submission is completed. When user want to update their form input they should not be directed again to the terms and conditions page. Therefore I use the following code:
Button1 is the submit/update button on the dynamic form page.

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;

// Query The “Free1 Database” if user has already submitted the form not go to terms and conditions, just save changes

export function button1_click() {
wixData.query(“Free1”)
const booleanValue = $w(“#dynamicDataset”).getCurrentItem().Agree
if (booleanValue === true ) {
wixLocation.to(‘https://www.purepropertycentralportugal.com/member-login’);
} else {
wixLocation.to(‘https://www.purepropertycentralportugal.com/terms-and-conditions’);
}
}
However, after the boolean is true in the database, the user is still directed to terms and conditions page. Could anyone see what is not correct in the code?

Thank you!

Vincent