From d9f6e6c1580fcb3627f823b59e41b1352a152e61 Mon Sep 17 00:00:00 2001 From: Luc Claustres Date: Thu, 12 Dec 2024 11:44:36 +0100 Subject: [PATCH] fix: Tiled wind/mesh layers does not work when coming from another backend (closes #1015) --- map/client/mixins/map/mixin.tiled-mesh-layers.js | 3 +-- map/client/mixins/map/mixin.tiled-wind-layers.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/map/client/mixins/map/mixin.tiled-mesh-layers.js b/map/client/mixins/map/mixin.tiled-mesh-layers.js index 5e7e7e612..b99373bfc 100644 --- a/map/client/mixins/map/mixin.tiled-mesh-layers.js +++ b/map/client/mixins/map/mixin.tiled-mesh-layers.js @@ -15,11 +15,10 @@ export const tiledMeshLayers = { const colorMap = _.get(options, 'variables[0].chromajs', null) if (colorMap) Object.assign(layerOptions, { chromajs: colorMap }) - const apiToken = await this.$api.get('storage').getItem(this.$config('gatewayJwt')) - // Build grid source const [gridKey, gridConf] = extractGridSourceConfig(options) const weacastApi = (typeof options.getPlanetApi === 'function' ? options.getPlanetApi() : this.getWeacastApi()) + const apiToken = (weacastApi.hasConfig('gatewayJwt') ? await weacastApi.get('storage').getItem(weacastApi.getConfig('gatewayJwt')) : null) const gridSource = makeGridSource(gridKey, { weacastApi, apiToken }) gridSource.setup(gridConf) if (gridSource.updateCtx) { diff --git a/map/client/mixins/map/mixin.tiled-wind-layers.js b/map/client/mixins/map/mixin.tiled-wind-layers.js index a120daf25..fbc00162c 100644 --- a/map/client/mixins/map/mixin.tiled-wind-layers.js +++ b/map/client/mixins/map/mixin.tiled-wind-layers.js @@ -25,7 +25,7 @@ export const tiledWindLayers = { vSource.setup(gridConf) if (uSource.updateCtx) { // define variables for source's dynamic properties - const gatewayToken = await this.$api.get('storage').getItem(this.$config('gatewayJwt')) + const gatewayToken = (weacastApi.hasConfig('gatewayJwt') ? await weacastApi.get('storage').getItem(weacastApi.getConfig('gatewayJwt')) : null) if (gatewayToken) { uSource.updateCtx.jwtToken = gatewayToken vSource.updateCtx.jwtToken = gatewayToken