Skip to content

Commit 62ca280

Browse files
committed
Add landsat api call and proxy
1 parent a1f0f7b commit 62ca280

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/services/get-products-service.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import { setProductsData } from "../redux/slices/mainSlice"
22
import { store } from '../redux/store'
33

4-
5-
// TODO: Replace with correct endpoint in the future
64
export async function GetProductsService() {
5+
await fetch(
6+
'/landsat/products',
7+
{
8+
method: 'GET'
9+
}
10+
)
11+
.then((response) => {
12+
return response.json
13+
});
714

815
// const allProductRequests = ALL_PROVIDERS.map(async provider => {
916
// return fetch('/api/products', {

vite.config.mts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ export default defineConfig({
2222
open: true,
2323
hmr: {
2424
overlay: false
25-
}
25+
},
26+
cors: false,
27+
proxy: {
28+
'/landsat': {
29+
target: 'https://qju8vxty89.execute-api.us-east-1.amazonaws.com',
30+
changeOrigin: true,
31+
rewrite: (path) => path.replace(/^\/landsat/, ''),
32+
},
33+
},
2634
},
2735
test: {
2836
globals: true,

0 commit comments

Comments
 (0)