Slightly smarter url retrieval in data
This commit is contained in:
parent
74e46eef11
commit
7123124aa6
1 changed files with 2 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
const BASE_URL = "http://localhost:8000"
|
const BASE_URL = window.location.href.replace(/^(http:\/\/[^/:]+).*/, "$1:8000")
|
||||||
|
|
||||||
let user = null;
|
let user = null;
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -9,7 +9,7 @@ export default {
|
||||||
meal.meal_date = new Date(meal.meal_date);
|
meal.meal_date = new Date(meal.meal_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
return meals;
|
return meals.sort((a, b) => a.meal_date - b.meal_date);
|
||||||
},
|
},
|
||||||
async getMeal(id) {
|
async getMeal(id) {
|
||||||
var response = await fetch(BASE_URL + `/meals/${encodeURIComponent(id)}`);
|
var response = await fetch(BASE_URL + `/meals/${encodeURIComponent(id)}`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue