Do not create layergroup if it is already provided

This commit is contained in:
Daniel García Aubert 2017-07-31 18:14:32 +02:00
parent aa6d01f151
commit 04da57fe0c

View File

@ -471,6 +471,11 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
} }
var layergroupId; var layergroupId;
if (params.layergroupid) {
layergroupId = params.layergroupid
}
step( step(
function createTemplate () { function createTemplate () {
var next = this; var next = this;
@ -512,6 +517,10 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
function createLayergroup(err, templateId) { function createLayergroup(err, templateId) {
var next = this; var next = this;
if (layergroupId) {
return next(null, layergroupId);
}
var data = templateId ? params.placeholders : self.mapConfig var data = templateId ? params.placeholders : self.mapConfig
var path = templateId ? var path = templateId ?
urlNamed + '/' + templateId + '?' + qs.stringify({api_key: self.apiKey}) : urlNamed + '/' + templateId + '?' + qs.stringify({api_key: self.apiKey}) :