1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-25 16:19:43 +02:00
This commit is contained in:
Hayden 2020-12-24 16:37:38 -09:00
commit beed8576c2
137 changed files with 40218 additions and 0 deletions

32
frontend/src/routes.js Normal file
View file

@ -0,0 +1,32 @@
import Home from "./components/Home";
import Page404 from "./components/Page404";
import Recipe from "./components/Recipe";
import NewRecipe from "./components/NewRecipe";
import Admin from "./components/Admin/Admin";
import MealPlanner from "./components/MealPlan/MealPlanner";
import ThisWeek from "./components/MealPlan/ThisWeek";
import api from "./api";
export const routes = [
{ path: "/", component: Home },
{ path: "/mealie", component: Home },
{ path: "/recipe/:recipe", component: Recipe },
{ path: "/new/", component: NewRecipe },
{ path: "/settings/site", component: Admin },
{ path: "/meal-plan/planner", component: MealPlanner },
{ path: "/meal-plan/this-week", component: ThisWeek },
{
path: "/meal-plan/today",
beforeEnter: async (_to, _from, next) => {
await todaysMealRoute().then((redirect) => {
next(redirect);
});
},
},
{ path: "*", component: Page404 },
];
async function todaysMealRoute() {
const response = await api.mealPlans.today();
return "/recipe/" + response.data;
}