Fixes mealie when meal plan is empty (#819)

This commit is contained in:
René Hansen 2024-11-04 20:39:05 +01:00 committed by GitHub
parent 18360e223f
commit 1ca9a4b0eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,9 +6,11 @@
<template v-if="item.subtitle">
{{ item.subtitle }}
</template>
<template v-else-if="meal"> Today: {{ meal[0].recipe.name }} </template>
<template v-else-if="stats">
happily keeping {{ stats.totalRecipes }} recipes organized
<template v-else-if="mealtext">
{{ mealtext }}
</template>
<template v-else-if="statsText">
{{ statsText }}
</template>
</p>
</template>
@ -32,6 +34,20 @@ export default {
stats: null,
meal: null,
}),
computed: {
mealtext: function () {
if (this.meal && this.meal.length > 0) {
return `Today: ${this.meal[0].recipe.name}`;
}
return null;
},
statsText: function () {
if (this.stats) {
return `Happily keeping ${this.stats.totalRecipes} recipes organized`;
}
return null;
}
},
created() {
this.fetchStatus();
},