@@ -220,7 +220,7 @@ export function getL7Filter(filter, featureFilter) {
220220}
221221
222222export function L7LayerUtil ( config ) {
223- const { featureFilter, expression, spec, L7Layer, L7 , proj4 } = config ;
223+ const { featureFilter, expression, spec, L7Layer, L7 , proj4, webMapService } = config ;
224224
225225 /**
226226 * @param {string } url
@@ -244,7 +244,7 @@ export function L7LayerUtil(config) {
244244 */
245245 function getRestDataFields ( datasetUrl , credential , options ) {
246246 const url = addCredentialToUrl ( `${ datasetUrl } /fields.json?returnAll=true` , credential ) ;
247- return FetchRequest . get ( url , null , options )
247+ return FetchRequest . get ( url , null , { ... options , withCredentials : webMapService . handleUrlWithCredentials ( url ) } )
248248 . then ( ( res ) => res . json ( ) )
249249 . then ( ( result ) => {
250250 return result . map ( ( item ) => {
@@ -270,7 +270,7 @@ export function L7LayerUtil(config) {
270270 */
271271 function getRestDataDomains ( datasetUrl , credential , options ) {
272272 const url = addCredentialToUrl ( `${ datasetUrl } /domain.json` , credential ) ;
273- return FetchRequest . get ( url , null , options ) . then ( ( result ) => {
273+ return FetchRequest . get ( url , null , { ... options , withCredentials : webMapService . handleUrlWithCredentials ( url ) } ) . then ( ( result ) => {
274274 return result . json ( ) ;
275275 } ) ;
276276 }
@@ -453,7 +453,7 @@ export function L7LayerUtil(config) {
453453 const nextOptions = handleWithRequestOptions ( datasetUrl , options ) ;
454454 const { fieldNames, fieldTypes } = await getRestDataFieldInfo ( datasetUrl , credential , nextOptions ) ;
455455 const nextUrl = addCredentialToUrl ( url , credential ) ;
456- const attrDataInfo = await FetchRequest . post ( nextUrl , JSON . stringify ( SQLParams ) , nextOptions ) ;
456+ const attrDataInfo = await FetchRequest . post ( nextUrl , JSON . stringify ( SQLParams ) , { ... nextOptions , withCredentials : webMapService . handleUrlWithCredentials ( nextUrl ) } ) ;
457457 const featuresRes = await attrDataInfo . json ( ) ;
458458
459459 return {
@@ -468,7 +468,7 @@ export function L7LayerUtil(config) {
468468 * @param option
469469 */
470470 function getStructDataItemJson ( href , option ) {
471- return FetchRequest . get ( href , null , option )
471+ return FetchRequest . get ( href , null , { ... option , withCredentials : webMapService . handleUrlWithCredentials ( href ) } )
472472 . then ( ( res ) => res . json ( ) )
473473 . then ( ( data ) => {
474474 if ( data . succeed === false ) {
@@ -616,10 +616,11 @@ export function L7LayerUtil(config) {
616616 */
617617 async function getStructuredDataGeojsonByWebMap ( data , options ) {
618618 const allFeature = await getStructDataGeojson ( data . dataId , options ) ;
619+ const url = `${ options . server } web/datas/${ data . dataId } /structureddata.json`
619620 const resultRes = await FetchRequest . get (
620- ` ${ options . server } web/datas/ ${ data . dataId } /structureddata.json` ,
621+ url ,
621622 null ,
622- options
623+ { ... options , withCredentials : webMapService . handleUrlWithCredentials ( url ) }
623624 ) ;
624625 const result = await resultRes . json ( ) ;
625626 const projection = `EPSG:${ result . epsgCode } ` ;
0 commit comments