Skip to content

Commit b30f57e

Browse files
committed
2 parents 4f09ea6 + bfc911c commit b30f57e

File tree

2 files changed

+45
-30
lines changed

2 files changed

+45
-30
lines changed

src/services/get-search-service.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,16 @@ export async function SearchService(searchParams, productData) {
104104
// "href": "stat-api.example.com?page=2"
105105
// }
106106
// };
107-
107+
console.log('REQUEST', searchParams)
108108
// TODO: PUT ENDPOINT HERE
109109
// check for selected product and map endpoint
110110
await fetch(productData.providerBaseUrl + '/products/maxar/opportunities', {
111111
method: 'POST',
112-
body: {} // TODO
112+
headers: {
113+
'Content-Type': 'application/json',
114+
Accept: '*/*'
115+
},
116+
body: JSON.stringify(searchParams)
113117
})
114118
.then((response) => {
115119
if (response.ok) {

src/utils/searchHelper.js

+39-28
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,50 @@ export function newSearch(filters, productData) {
3131
const dates = store.getState().mainSlice.searchDateRangeValue
3232
const productId = store.getState().mainSlice.selectedProductData.id
3333
console.log(geometry, dates, filters)
34-
34+
console.log(geometry)
3535
const query = {
36-
product_id: productId,
37-
datetime: `${dates[0]}/${dates[1]}`,
38-
geometry: geometry.geometry,
36+
//product_id: productId,
37+
datetime: "2025-04-21T00:00:00.000Z/2025-04-29T23:59:59.000Z" || `${dates[0]}/${dates[1]}`,
38+
geometry: {
39+
type: 'Polygon',
40+
coordinates: [
41+
[
42+
[131.4067090823608, -24.863581247683243],
43+
[131.4067090823608, -24.946918997631883],
44+
[131.51697981183463, -24.946918997631883],
45+
[131.51697981183463, -24.863581247683243],
46+
[131.4067090823608, -24.863581247683243]
47+
]
48+
]
49+
},
3950
filter: {
40-
op: 'and',
41-
args: []
51+
// op: 'and',
52+
// args: []
4253
}
4354
}
4455

45-
for (const [key, value] of Object.entries(filters)) {
46-
const lowerBounds = {
47-
op: '>=',
48-
args: [
49-
{
50-
property: key
51-
},
52-
value[0]
53-
]
54-
}
55-
query.filter.args.push(lowerBounds)
56-
const upperBounds = {
57-
op: '<=',
58-
args: [
59-
{
60-
property: key
61-
},
62-
value[1]
63-
]
64-
}
65-
query.filter.args.push(upperBounds)
66-
}
56+
// for (const [key, value] of Object.entries(filters)) {
57+
// const lowerBounds = {
58+
// op: '>=',
59+
// args: [
60+
// {
61+
// property: key
62+
// },
63+
// value[0]
64+
// ]
65+
// }
66+
// query.filter.args.push(lowerBounds)
67+
// const upperBounds = {
68+
// op: '<=',
69+
// args: [
70+
// {
71+
// property: key
72+
// },
73+
// value[1]
74+
// ]
75+
// }
76+
// query.filter.args.push(upperBounds)
77+
// }
6778

6879
console.log(query)
6980

0 commit comments

Comments
 (0)