server 1.0.3
This commit is contained in:
@@ -105,15 +105,21 @@ export async function renewSubscription(restaurantId, monthsToAdd) {
|
||||
}
|
||||
|
||||
export async function fetchRestaurant(id) {
|
||||
let data;
|
||||
await Restaurant.findById(id, (err, result) => {
|
||||
data = result;
|
||||
}).catch((e) => {
|
||||
const data = await Restaurant.findById(id).catch((e) => {
|
||||
throw newError("Nie udało się pobrać restauracji.", 500);
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function fetchMultipleRestaurants(idArray) {
|
||||
let data = [];
|
||||
for (const id of idArray) {
|
||||
let response = await fetchRestaurant(id);
|
||||
data.push(response);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function fetchAllDishesForRestaurant(restaurant) {
|
||||
let dishes = [];
|
||||
for (const dish of restaurant.dishes) {
|
||||
|
||||
Reference in New Issue
Block a user