Skip to content

Commit

Permalink
axios fix
Browse files Browse the repository at this point in the history
  • Loading branch information
unfiltered-syrup committed Dec 7, 2023
1 parent e5b3e2f commit 06440fb
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions front-end/src/utils/stopTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ import axios from "axios";
async function getShuttleTimes(stopName, route) {
const url = `http://localhost:4000/stopfind/${stopName}/${route}`;
console.log(url);
return axios
.get(url)
.then((response) => {
//console.log(response.data);
return response.data;
})
.catch((error) => {
console.error("Axios error:", error);
throw error;
});
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
// console.log(data);
return data;
})
.catch(error => {
console.error('Fetch error:', error);
throw error;
});
}

async function getTimes(stopName, route) {
Expand Down

0 comments on commit 06440fb

Please sign in to comment.