server v1.0.7

This commit is contained in:
2020-10-01 20:21:01 +02:00
parent 5d6c7d5e3f
commit 63c2fb88e0
6 changed files with 33 additions and 37 deletions

View File

@@ -112,11 +112,9 @@ export async function verifyDishAccess(dishId, decodedToken) {
}
);
const restaurants = fetch.restaurants;
const restaurantId = await Dish.findById(dishId, "restaurantId").catch(
(error) => {
throw newError("Nie znaleziono dania.", 404);
}
);
const restaurantId = await Dish.findById(dishId).catch((error) => {
throw newError("Nie znaleziono dania.", 404);
});
const valid = restaurants.includes(restaurantId.restaurantId);
if (!valid) throw newError("Nie masz dostępu do tego dania.", 401);
}