use axios instead of fetch

This commit is contained in:
liamcottle
2024-09-07 23:45:53 +12:00
parent 816193dff6
commit fff4cc9a49

View File

@ -3697,11 +3697,10 @@
clearMap();
// fetch nodes
await fetch('/api/v1/nodes').then(async (response) => {
await window.axios.get('/api/v1/nodes').then(async (response) => {
// update nodes
var json = await response.json();
onNodesUpdated(json.nodes);
onNodesUpdated(response.data.nodes);
// hide loading
setLoading(false);
@ -3722,12 +3721,8 @@
});
// fetch waypoints (after awaiting nodes, so we can use nodes cache in waypoint tooltips)
await fetch('/api/v1/waypoints').then(async (response) => {
// update waypoints
var json = await response.json();
onWaypointsUpdated(json.waypoints);
await window.axios.get('/api/v1/waypoints').then(async (response) => {
onWaypointsUpdated(response.data.waypoints);
});
}