mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-03 17:14:10 -05:00
More localization (#358)
* Translate missing items on About page * Localize import summary dialog * Make site menu translation reactive * Localize import options * Include semi colon in string * Move API texts to frontend + better status codes * Provide feedback to user when no meal is planned * Fix API tests after latest rework * Add warning for API changes in changelog * Refactor API texts handling * Refactor API texts handling #2 * Better API feedback * Rearrange strings hierarchy * Add messages upon recipe updated * Fix 'recipe effected' typo * Remove snackbar usage in backend * Translate toolbox * Provide feedback for tags CRUD * Fix messed up merge * Translate sign-up form * Better feedback for sign-up CRUD * Refactor log-in API texts handling * No error message when user is not authenticated * Remove unimportant console log
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user