Skip to content

Commit 2d6312c

Browse files
author
ChenGuanglin
committed
【update】通过web添加geojson不需要携带cookie
review by zhaoq
1 parent e526624 commit 2d6312c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ export class WebMap extends Observable {
14881488
})
14891489
}
14901490
} else if(dataSource && dataSource.type === "USER_DATA") {
1491-
that.addGeojsonFromUrl(layer, len, layerIndex);
1491+
that.addGeojsonFromUrl(layer, len, layerIndex, false);
14921492
} else if (layer.layerType === 'SUPERMAP_REST' ||
14931493
layer.layerType === "TILE" ||
14941494
layer.layerType === "WMS" ||
@@ -1553,11 +1553,13 @@ export class WebMap extends Observable {
15531553
* @param {object} layerInfo - 图层信息
15541554
* @param {Number} len - 总的图层数量
15551555
* @param {Number} layerIndex - 当前图层index
1556+
* @param {Boolean} withCredentials - 是否携带cookie
15561557
*/
1557-
addGeojsonFromUrl(layerInfo, len, layerIndex) {
1558+
addGeojsonFromUrl(layerInfo, len, layerIndex, withCredentials = this.withCredentials) {
1559+
// 通过web添加geojson不需要携带cookie
15581560
let {dataSource} = layerInfo, {url} = dataSource, that = this;
15591561
FetchRequest.get(url, null, {
1560-
withCredentials: this.withCredentials,
1562+
withCredentials,
15611563
withoutFormatSuffix: true
15621564
}).then(function (response) {
15631565
return response.json()

0 commit comments

Comments
 (0)