Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getLayer(options) {
const account = options.account
const mapConfig = {
version: "1.0.1",
layers: [{
type: 'mapnik',
options: objectAssign(
{
sql: condenseWhitespace(options.sql),
cartocss_version: "2.3.0",
},
options
)
}]
}
return axios.post(`https://${account}.cartodb.com/api/v1/map/`, mapConfig)
.then(({data}) => {
const layerid = data.layergroupid
const urls = {
tilesUrl: `https://${account}.cartodb.com/api/v1/map/${layerid}/{z}/{x}/{y}.png`
}
if (options.interactivity) {
urls.gridsUrl = `https://${account}.cartodb.com/api/v1/map/${layerid}/0/{z}/{x}/{y}.grid.json`
}