Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
ConditionsMap: Align backend call
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb-sti1 committed Oct 19, 2023
1 parent 4f9c757 commit 0020096
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions frontend/src/Components/Conditions/ConditionsMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { PathOptions } from 'leaflet';
import { FeatureCollection } from 'geojson';

import MapWrapper from '../Map/MapWrapper';
import { getConditions } from '../../queries/fetchConditions';
import {
DateRange,
DI,
Expand All @@ -15,6 +14,7 @@ import {
Mu,
YearMonth,
} from '../../models/conditions';
import { getAllConditions } from '../../queries/conditions';

const lessOrEqualThan = (
yearMonth1: YearMonth,
Expand Down Expand Up @@ -130,7 +130,7 @@ const ConditionsMap: FC<ConditionsMapProps> = ({

useEffect(() => {
// Load the conditions from the backend
getConditions((data) => {
getAllConditions((data) => {
const range: DateRange = {};
data.features.forEach((f) => {
if (f.properties !== null && f.properties.valid_time !== undefined) {
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/queries/conditions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MapBounds } from '../models/map';
import { ConditionKPIDI, WaysConditions } from '../models/path';
import { asyncPost, post } from './fetch';
import { asyncPost, get, post } from './fetch';
import { FeatureCollection } from 'geojson';

export const getWaysConditions = (
type: string,
Expand Down Expand Up @@ -29,3 +30,9 @@ export const getBoundedWaysConditions = async (
zoom,
});
};

export const getAllConditions = (
callback: (data: FeatureCollection) => void,
) => {
get('/conditions', callback);
};
17 changes: 0 additions & 17 deletions frontend/src/queries/fetchConditions.ts

This file was deleted.

0 comments on commit 0020096

Please sign in to comment.