@drift-labs/common
Version:
Common functions for Drift
20 lines • 661 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkGeoBlock = void 0;
const constants_1 = require("../../constants");
/**
* Returns true if the user is geo-blocked.
*/
const checkGeoBlock = async () => {
const result = await fetch(`https://geolocation.drift-labs.workers.dev/`, {
cache: 'no-cache',
});
if (!result.ok) {
return;
}
const country_code = await result.text();
const countryIsBlocked = !!constants_1.GEOBLOCK_LIST.find((country) => country.code === country_code);
return countryIsBlocked;
};
exports.checkGeoBlock = checkGeoBlock;
//# sourceMappingURL=index.js.map
;