Skip to content

Commit

Permalink
Merge pull request #4959 from HSLdevcom/fix-weather
Browse files Browse the repository at this point in the history
fix: broken weather data parsing
  • Loading branch information
sharhio authored Feb 21, 2024
2 parents 60a33b0 + 3264fe3 commit 717dfb6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/util/apiUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import moment from 'moment';
import xmlParser from 'fast-xml-parser';
import { XMLParser } from 'fast-xml-parser';
import isEmpty from 'lodash/isEmpty';
import { retryFetch } from './fetchUtils';

Expand Down Expand Up @@ -56,13 +56,11 @@ export function getWeatherData(baseURL, time, lat, lon) {
)
.then(res => res.text())
.then(str => {
const options = {
const parser = new XMLParser({
ignoreAttributes: true,
removeNSPrefix: true,
};
return xmlParser.parse(str, options);
})
.then(json => {
});
const json = parser.parse(str);
const data = json.FeatureCollection.member.map(elem => elem.BsWfsElement);
return data;
})
Expand Down

0 comments on commit 717dfb6

Please sign in to comment.