Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic error cdi; COUNTRY=jordan #1259

Merged
merged 10 commits into from
Jul 3, 2024
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ cd frontend
yarn clean
yarn install
yarn setup:common
REACT_APP_COUNTRY=cambodia yarn start
REACT_APP_COUNTRY=jordan REACT_APP_USE_LOCAL_HIP_SERVICE=http://localhost:3001/q_multi_geojson docker compose up
gislawill marked this conversation as resolved.
Show resolved Hide resolved
```

### Available Scripts
Expand Down
1 change: 1 addition & 0 deletions frontend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
entrypoint: yarn start
environment:
- REACT_APP_COUNTRY
- REACT_APP_USE_LOCAL_HIP_SERVICE=http://localhost:3001/q_multi_geojson
ports:
- "3000:3000"
volumes:
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/context/layers/composite_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export const fetchCompositeLayerData: LazyLoader<CompositeLayerProps> = () => as
const endDate = new Date(startDate);
endDate.setMonth(endDate.getMonth() + 1);

const { baseUrl, inputLayers, startDate: areaStartDate } = layer;
const { baseUrl: _baseUrl, inputLayers, startDate: areaStartDate } = layer;
const baseUrl = process.env.REACT_APP_USE_LOCAL_HIP_SERVICE
? process.env.REACT_APP_USE_LOCAL_HIP_SERVICE
: _baseUrl;
const { boundingBox } = appConfig.map;

// docs: https://hip-service.ovio.org/docs#/default/run_q_multi_geojson_q_multi_geojson_post
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/utils/fetch-with-timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ export const fetchWithTimeout = async (
signal: controller.signal,
});
if (!res.ok) {
throw new HTTPError(
fetchErrorMessage ?? `Something went wrong requesting at ${resource}`,
res.status,
);
await res.json().then(r => {
// eslint-disable-next-line no-console
console.log(r);
throw new HTTPError(
r.detail ??
fetchErrorMessage ??
`Something went wrong requesting at ${resource}`,
res.status,
);
});
gislawill marked this conversation as resolved.
Show resolved Hide resolved
}
return res;
} catch (error) {
Expand Down
Loading