Remove mock code from repo
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
a69112d901
commit
85b178ca07
1 changed files with 21 additions and 47 deletions
|
@ -1,53 +1,39 @@
|
|||
const API_URL = "http://localhost:8000/api";
|
||||
const API_URL = "https://ale-dev.teck-developer.com/api";
|
||||
|
||||
const getAllRoutes = async () => {
|
||||
let data = [];
|
||||
if (import.meta.env.DEV && import.meta.env.PROD) {
|
||||
const response = await fetch(`${API_URL}/all-routes`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
} else {
|
||||
data = (await import('./mock/routes.json')).default;
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_URL}/all-routes`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const getRouteCategories = async () => {
|
||||
let data = [];
|
||||
if (import.meta.env.DEV && import.meta.env.PROD) {
|
||||
const response = await fetch(`${API_URL}/route-categories`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
} else {
|
||||
data = (await import('./mock/routeCategories.json')).default;
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_URL}/route-categories`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const getRouteByCategory = async (categoryId: number) => {
|
||||
let data = [];
|
||||
if (import.meta.env.DEV && import.meta.env.PROD) {
|
||||
const response = await fetch(`${API_URL}/route-by-category/${categoryId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
} else {
|
||||
data = (await import('./mock/routeByCategory.json')).default;
|
||||
}
|
||||
const response = await fetch(`${API_URL}/route-by-category/${categoryId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const getRoute = async (routeId: number) => {
|
||||
let data = {};
|
||||
if (import.meta.env.DEV && import.meta.env.PROD) {
|
||||
const response = await fetch(`${API_URL}/route/${routeId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
} else {
|
||||
data = (await import('./mock/route.json')).default;
|
||||
}
|
||||
const response = await fetch(`${API_URL}/route/${routeId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -55,30 +41,18 @@ const getRoute = async (routeId: number) => {
|
|||
|
||||
const getSport = async (routeId: number, sportId: number) => {
|
||||
let data = {};
|
||||
if (import.meta.env.DEV && import.meta.env.PROD) {
|
||||
const response = await fetch(`${API_URL}/route/${routeId}/${sportId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
} else {
|
||||
data = (await import('./mock/sport.json')).default;
|
||||
}
|
||||
const response = await fetch(`${API_URL}/route/${routeId}/${sportId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const downloadGPX = async (routeId: number, sportId: number) => {
|
||||
// Code for downloading this gpx
|
||||
}
|
||||
|
||||
const getPlacemarks = async (routeId: number, sportId: number) => {
|
||||
let data = {};
|
||||
if (import.meta.env.DEV && import.meta.env.PROD) {
|
||||
const response = await fetch(`${API_URL}/getPlacemarks/${routeId}/${sportId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
} else {
|
||||
data = (await import('./mock/placemark.json')).default;
|
||||
}
|
||||
const response = await fetch(`${API_URL}/getPlacemarks/${routeId}/${sportId}`);
|
||||
const json = await response.json();
|
||||
data = json;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue