Hi,
The velo code was working great until recently when it stopped working. I didn’t change the code but I added a store. I think it stopped working since I added the store. Any suggestions? Here’s the code.
import wixData from ‘wix-data’ ;
import { GetFXRates } from ‘backend/GetFXRates.jsw’ ;
import { getJSON } from ‘wix-fetch’ ;
const databaseName = ‘IVFPackagesbyCountry’ ;
const databaseField = ‘tags’ ;
// $w.onReady(function () {
// dataset1_ready();
// $w(‘#treatmentTags’).onChange((event) => {
// const selectedTag = $w(‘#treatmentTags’).value;
// addItemstoRepeater(selectedTag);
// })
// });
import wixLocation from ‘wix-location’ ;
import { fetch } from ‘wix-fetch’ ; $w . onReady ( function () { // Fetch the user’s location details
fetch ( ‘https://extreme-ip-lookup.com/json’ , {
method : ‘get’
}) // Check if the request was successful
. then (( httpResponse ) => {
if ( httpResponse . ok ) {
**return** httpResponse . json ();
}
})
. then (( json ) => {
// Set the user's countryCode as a const
const loc = json . countryCode ; /* Check if location is India, and check if the visitor is not on Pricing-in page */
console . log ( loc );
if ( loc === "GB" ){
// Redirect to "pricing-in" page
wixLocation . to ( "/uk" );
$w ( '#treatmentTags' ). onChange (( event ) => {
const selectedTag = $w ( '#treatmentTags' ). value ;
addItemstoRepeater ( selectedTag );
})
}
});
})
function addItemstoRepeater ( selectedOption = ) {
let dataQuery = wixData . query ( databaseName );
if ( selectedOption . length > 0 ) {
dataQuery = dataQuery . hasSome ( databaseField , selectedOption );
}
dataQuery
. find ()
. then ( results => {
const filtereditemsReady = results . items ;
$w ( '#packages' ). data = filtereditemsReady ;
})
}