Replace graph with an svg path
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import axios from "axios";
|
||||
|
||||
export default axios.create({
|
||||
baseURL: "https://dijkstra-backend.herokuapp.com/",
|
||||
baseURL: "http://localhost:4000",
|
||||
responseType: "json"
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import Axios from './API';
|
||||
|
||||
export async function fetchRoads() {
|
||||
try {
|
||||
const { data } = await Axios.get(
|
||||
`api/roads`
|
||||
);
|
||||
return data
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
export async function fetchCities() {
|
||||
try {
|
||||
const { data } = await Axios.get(
|
||||
`api/countries/1`
|
||||
);
|
||||
return data
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
export async function getShortestPath(startingPointId, destinationID) {
|
||||
try {
|
||||
const response = await Axios.get(
|
||||
`api/path`,
|
||||
{
|
||||
params: {
|
||||
start_city_id: startingPointId,
|
||||
end_city_id: destinationID
|
||||
}
|
||||
}
|
||||
);
|
||||
return response.data
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user