mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-21 22:13:31 -07:00
Provide feedback to user when no meal is planned
This commit is contained in:
parent
330941522f
commit
ebf38add4a
3 changed files with 23 additions and 3 deletions
|
@ -17,6 +17,8 @@
|
|||
- Fixes #281 - Slow Handling of Large Sets of Recipes
|
||||
|
||||
## Features and Improvements
|
||||
- 'Dinner this week' shows a warning when no meal is planned yet
|
||||
- 'Dinner today' shows a warning when no meal is planned yet
|
||||
|
||||
### General
|
||||
- More localization
|
||||
|
@ -32,4 +34,6 @@
|
|||
|
||||
### Behind the Scenes
|
||||
- Unified Sidebar Components
|
||||
- Refactor UI components to fit Vue best practices (WIP)
|
||||
- Refactor UI components to fit Vue best practices (WIP)
|
||||
- The API returns more consistent status codes
|
||||
- The API returns error code instead of error text when appropriate
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
<script>
|
||||
import { api } from "@/api";
|
||||
import utils from "@/utils";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
@ -60,6 +61,9 @@ export default {
|
|||
},
|
||||
async mounted() {
|
||||
this.mealPlan = await api.mealPlans.thisWeek();
|
||||
if(!this.mealPlan) {
|
||||
utils.notify.warning(this.$t('meal-plan.no-meal-plan-defined-yet'))
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getOrder(index) {
|
||||
|
|
|
@ -2,6 +2,9 @@ import Planner from "@/pages/MealPlan/Planner";
|
|||
import ThisWeek from "@/pages/MealPlan/ThisWeek";
|
||||
import { api } from "@/api";
|
||||
|
||||
import i18n from '@/i18n.js';
|
||||
import utils from "@/utils";
|
||||
|
||||
export const mealRoutes = [
|
||||
{
|
||||
path: "/meal-plan/planner",
|
||||
|
@ -21,7 +24,12 @@ export const mealRoutes = [
|
|||
path: "/meal-plan/today",
|
||||
beforeEnter: async (_to, _from, next) => {
|
||||
await todaysMealRoute().then(redirect => {
|
||||
next(redirect);
|
||||
if(redirect) {
|
||||
next(redirect);
|
||||
} else {
|
||||
utils.notify.error(i18n.t('meal-plan.no-meal-planned-for-today'));
|
||||
next(_from);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@ -29,5 +37,9 @@ export const mealRoutes = [
|
|||
|
||||
async function todaysMealRoute() {
|
||||
const response = await api.mealPlans.today();
|
||||
return "/recipe/" + response.data;
|
||||
if (response.status == 200 && response.data) {
|
||||
return "/recipe/" + response.data;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue