This is what I have done -
import { fetch } from 'wix-fetch';
import wixData from 'wix-data';
$w.onReady(function () { });
function checkIP(){
fetch('https://extreme-ip-lookup.com/json', {method: 'get' })
.then((httpResponse) => {
if (httpResponse.ok){
return httpResponse.json();
}
})
.then((json) => {
const ipAddress = json.query;
wixData.query("IPAddress")
.eq("ip", ipAddress)
.find()
.then((results) => {
if(results.items.length === 0){
// Block The Member
}
else{
// Allow The Member
}
})
return ipAddress; // Do we need this??
})
}
Please guide me further.