allow mealplan with no categories

This commit is contained in:
hay-kot 2021-03-04 21:25:09 -09:00
commit 741ed9a557
2 changed files with 14 additions and 2 deletions

View file

@ -70,7 +70,7 @@ export default {
router.push(`/`);
},
async allByKeys(recipeKeys, num = 999) {
async allByKeys(recipeKeys, num = 9999) {
const response = await apiReq.get(recipeURLs.allRecipes, {
params: {
keys: recipeKeys,

View file

@ -118,6 +118,19 @@ export default {
async mounted() {
let settings = await api.settings.requestAll();
this.items = await api.recipes.getAllByCategory(settings.planCategories);
console.log(this.items);
if (this.items.length === 0) {
const keys = [
"name",
"slug",
"image",
"description",
"dateAdded",
"rating",
];
this.items = await api.recipes.allByKeys(keys);
}
},
computed: {
@ -133,7 +146,6 @@ export default {
let dateDif = (endDate - startDate) / (1000 * 3600 * 24) + 1;
if (dateDif < 1) {
return null;
}