@@ -2,32 +2,30 @@ import { setProductsData } from '../redux/slices/mainSlice'
22import { store } from '../redux/store'
33
44export async function GetProductsService ( provider , apikey ) {
5- // const allProductRequests = ALL_PROVIDERS.map(async provider => {
6- // return fetch('/api/products', {
7- // headers: new Headers({
8- // 'Backend': provider.id,
9- // 'Authorization': `Bearer ${userToken}`
10- // })
11- // })
12- // .then(async res => await res.json())
13- // .then(data => { return { 'provider': provider.id, 'data': data } })
14- // });
5+ // const allProductRequests = ALL_PROVIDERS.map(async provider => {
6+ // return fetch('/api/products', {
7+ // headers: new Headers({
8+ // 'Backend': provider.id,
9+ // 'Authorization': `Bearer ${userToken}`
10+ // })
11+ // })
12+ // .then(async res => await res.json())
13+ // .then(data => { return { 'provider': provider.id, 'data': data } })
14+ // });
1515
1616 // Promise.all(allProductRequests).then((results) => {
1717 // store.dispatch(setProductsData(Object.fromEntries(Object.values(results).map(value => {
1818 // return value.data.products
1919 // }))))
2020 // }).catch(e => setError(e));
2121
22- /* .then(async res => await res.json())
22+ /* .then(async res => await res.json())
2323 .then((data) => {
2424 console.log(data)
2525 umbraProducts = data.products
2626 store.dispatch(setProductsData([...eusiProducts, ...umbraProducts, ...planetProducts]))
2727 }); */
2828
29-
30-
3129 const planetProducts = [
3230 {
3331 type : 'Product' ,
@@ -368,21 +366,11 @@ export async function GetProductsService(provider, apikey) {
368366 }
369367 }
370368 ]
371- // TODO: PUT ENDPOINT HERE
372- // const endpoint = '/landsat/products'
373- // const eusiProducts = await fetch(endpoint, {
374- // method: 'GET'
375- // })
376- // .then(async (res) => await res.json())
377- // .then((data) => {
378- // console.log(data)
379- // umbraProducts = data.products
380- // })
381369
382370 const eusiProducts = [
383371 {
384372 type : 'Product' ,
385- conformsTo : [ ] ,
373+ conformsTo : [ 'https://geojson.org/schema/Polygon.json' ] ,
386374 id : 'maxar' ,
387375 title : 'Maxar Optical' ,
388376 description : 'Optical Imagary from the Maxar constellation' ,
@@ -491,89 +479,89 @@ export async function GetProductsService(provider, apikey) {
491479 }
492480 ]
493481
494- // // const EUSI_MAXAR_OPTICAL_PRODUCT = {
495- // type: 'Product',
496- // stat_version: '0.0.1',
497- // stat_extensions: [],
498- // id: 'maxar_opt',
499- // title: 'Maxar tasking',
500- // description: '',
501- // keywords: ['EO', 'OPTICAL', 'WV01', 'WV02', 'WV03', 'GE01', 'VHR'],
502- // license: 'proprietary',
503- // providers: [
504- // {
505- // name: 'EUSI',
506- // description: null,
507- // roles: ['licensor', 'processor', 'producer', 'host'],
508- // url: 'https://www.euspaceimaging.com'
509- // }
510- // ],
511- // links: [],
512- // constraints: {
513- // additionalProperties: true,
514- // properties: {
515- // offNadirAngle: {
516- // title: 'Offnadirangle',
517- // type: 'integer'
518- // },
519- // sensor: {
520- // title: 'Sensor',
521- // type: 'string'
522- // }
523- // },
524- // required: ['offNadirAngle', 'sensor'],
525- // title: 'MaxarConstraints',
526- // type: 'object'
527- // },
528- // parameters: {
529- // additionalProperties: false,
530- // properties: {
531- // customerReference: {
532- // default: '',
533- // description:
534- // 'Free text parameter containing the client reference to the tasking order',
535- // title: 'Customer Reference',
536- // type: 'string'
537- // },
538- // opportunityRequestId: {
539- // description:
540- // 'ID returned from an opportunity request. Must be included to place order.',
541- // title: 'Opportunity Request Id',
542- // type: 'string'
543- // },
544- // endUserIds: {
545- // description:
546- // 'Parameter containing a list of EUSI assigned UUID for the end users',
547- // title: 'EUSI Enduser ID',
548- // type: 'string'
549- // },
550- // endUseCode: {
551- // description:
552- // 'Parameter containing the end use code describing usage of the imagery',
553- // title: 'EUSI Enduse Code',
554- // type: 'string'
555- // }
556- // },
557- // required: ['opportunityRequestId', 'endUserIds', 'endUseCode'],
558- // title: 'MaxarOrderParameters',
559- // type: 'object'
560- // }
561- // // }
562- // // const EUSI_PRODUCTS = [EUSI_MAXAR_OPTICAL_PRODUCT]
482+ // // const EUSI_MAXAR_OPTICAL_PRODUCT = {
483+ // type: 'Product',
484+ // stat_version: '0.0.1',
485+ // stat_extensions: [],
486+ // id: 'maxar_opt',
487+ // title: 'Maxar tasking',
488+ // description: '',
489+ // keywords: ['EO', 'OPTICAL', 'WV01', 'WV02', 'WV03', 'GE01', 'VHR'],
490+ // license: 'proprietary',
491+ // providers: [
492+ // {
493+ // name: 'EUSI',
494+ // description: null,
495+ // roles: ['licensor', 'processor', 'producer', 'host'],
496+ // url: 'https://www.euspaceimaging.com'
497+ // }
498+ // ],
499+ // links: [],
500+ // constraints: {
501+ // additionalProperties: true,
502+ // properties: {
503+ // offNadirAngle: {
504+ // title: 'Offnadirangle',
505+ // type: 'integer'
506+ // },
507+ // sensor: {
508+ // title: 'Sensor',
509+ // type: 'string'
510+ // }
511+ // },
512+ // required: ['offNadirAngle', 'sensor'],
513+ // title: 'MaxarConstraints',
514+ // type: 'object'
515+ // },
516+ // parameters: {
517+ // additionalProperties: false,
518+ // properties: {
519+ // customerReference: {
520+ // default: '',
521+ // description:
522+ // 'Free text parameter containing the client reference to the tasking order',
523+ // title: 'Customer Reference',
524+ // type: 'string'
525+ // },
526+ // opportunityRequestId: {
527+ // description:
528+ // 'ID returned from an opportunity request. Must be included to place order.',
529+ // title: 'Opportunity Request Id',
530+ // type: 'string'
531+ // },
532+ // endUserIds: {
533+ // description:
534+ // 'Parameter containing a list of EUSI assigned UUID for the end users',
535+ // title: 'EUSI Enduser ID',
536+ // type: 'string'
537+ // },
538+ // endUseCode: {
539+ // description:
540+ // 'Parameter containing the end use code describing usage of the imagery',
541+ // title: 'EUSI Enduse Code',
542+ // type: 'string'
543+ // }
544+ // },
545+ // required: ['opportunityRequestId', 'endUserIds', 'endUseCode'],
546+ // title: 'MaxarOrderParameters',
547+ // type: 'object'
548+ // }
549+ // // }
550+ // // const EUSI_PRODUCTS = [EUSI_MAXAR_OPTICAL_PRODUCT]
551+
552+ switch ( provider ) {
553+ case 'eusi' :
554+ store . dispatch ( setProductsData ( eusiProducts ) )
555+ return
556+ case 'umbra' :
557+ store . dispatch ( setProductsData ( umbraProducts ) )
558+ return
559+ case 'planet' :
560+ store . dispatch ( setProductsData ( planetProducts ) )
561+ return
562+ default :
563+ console . error ( 'Unsupported provider' , provider )
564+ }
563565
564- switch ( provider ) {
565- case 'eusi' :
566- store . dispatch ( setProductsData ( eusiProducts ) )
567- return
568- case 'umbra' :
569- store . dispatch ( setProductsData ( umbraProducts ) )
570- return
571- case 'planet' :
572- store . dispatch ( setProductsData ( planetProducts ) )
573- return
574- default :
575- console . error ( 'Unsupported provider' , provider )
576- }
577-
578566 // store.dispatch(setProductsData(mockProducts))
579567}
0 commit comments