@@ -10,6 +10,7 @@ import {
1010import { addDataToLayer , footprintLayerStyle } from '../utils/mapHelper'
1111
1212export async function SearchService ( searchParams , productData , apiKey ) {
13+ /*
1314 const opportunities = [{
1415 id: 'cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d',
1516 product_id: 'maxar',
@@ -43,6 +44,7 @@ export async function SearchService(searchParams, productData, apiKey) {
4344 }
4445 ]
4546 }]
47+
4648 console.log(opportunities[0].opportunity_request)
4749 const featureHack = {
4850 type: 'FeatureCollection',
@@ -72,6 +74,7 @@ export async function SearchService(searchParams, productData, apiKey) {
7274 store.dispatch(sethasLeftPanelTabChanged(true))
7375
7476 return
77+ */
7578
7679 /// ///////
7780 console . log ( 'REQUEST' , searchParams )
@@ -94,16 +97,34 @@ export async function SearchService(searchParams, productData, apiKey) {
9497 console . log ( 'RESPONSE' , json )
9598
9699 const opportunities = json . response ( )
97- store . dispatch ( setSearchResults ( opportunities ) )
98- // store.dispatch(setmappedScenes(fakeOpportunities.features))
100+ const featureHack = {
101+ type : 'FeatureCollection' ,
102+ features : [ ]
103+ }
104+ for ( const [ key , value ] of Object . entries ( opportunities ) ) {
105+ featureHack . features . push ( {
106+ type : 'Feature' ,
107+ properties : { id : value . id } ,
108+ geometry : value . opportunity_request . geometry
109+ } )
110+ }
111+
112+ console . log ( featureHack )
113+
114+ store . dispatch ( setSearchResults ( featureHack ) )
115+ store . dispatch ( setmappedScenes ( featureHack ) )
99116 const options = {
100117 style : footprintLayerStyle
101118 }
102119 store . dispatch ( setSearchLoading ( false ) )
103- addDataToLayer ( opportunities , 'searchResultsLayer' , options , true )
120+
121+ addDataToLayer ( featureHack , 'searchResultsLayer' , options , true )
104122 // store.dispatch(setClickResults(fakeOpportunities.features))
105123 store . dispatch ( settabSelected ( 'details' ) )
106124 store . dispatch ( sethasLeftPanelTabChanged ( true ) )
125+
126+
127+
107128 } )
108129 . catch ( ( error ) => {
109130 store . dispatch ( setSearchLoading ( false ) )
0 commit comments