2021-06-17 15:19:37 -08:00
|
|
|
const ViewRecipe = () => import(/* webpackChunkName: "recipe-page" */ "@/pages/Recipe/ViewRecipe");
|
|
|
|
|
const NewRecipe = () => import(/* webpackChunkName: "recipe-page" */ "@/pages/Recipe/NewRecipe");
|
2021-06-15 21:43:04 -08:00
|
|
|
const ScraperDebugger = () => import("@/pages/Recipe/ScraperDebugger");
|
|
|
|
|
const CustomPage = () => import("@/pages/Recipes/CustomPage");
|
|
|
|
|
const AllRecipes = () => import("@/pages/Recipes/AllRecipes");
|
|
|
|
|
const CategoryTagPage = () => import("@/pages/Recipes/CategoryTagPage");
|
|
|
|
|
const Favorites = () => import("@/pages/Recipes/Favorites");
|
2021-04-21 21:52:12 -08:00
|
|
|
import { api } from "@/api";
|
|
|
|
|
|
|
|
|
|
export const recipeRoutes = [
|
|
|
|
|
// Recipes
|
|
|
|
|
{ path: "/recipes/all", component: AllRecipes },
|
2021-06-09 13:04:54 -08:00
|
|
|
{ path: "/recipes/debugger", component: ScraperDebugger },
|
2021-05-29 15:54:18 -08:00
|
|
|
{ path: "/user/:id/favorites", component: Favorites },
|
2021-05-07 14:33:20 -08:00
|
|
|
{ path: "/recipes/tag/:tag", component: CategoryTagPage },
|
2021-05-23 12:38:55 -08:00
|
|
|
{ path: "/recipes/tag", component: CategoryTagPage },
|
|
|
|
|
{ path: "/recipes/category", component: CategoryTagPage },
|
2021-05-07 14:33:20 -08:00
|
|
|
{ path: "/recipes/category/:category", component: CategoryTagPage },
|
2021-04-21 21:52:12 -08:00
|
|
|
// Misc
|
|
|
|
|
{ path: "/new/", component: NewRecipe },
|
|
|
|
|
{ path: "/pages/:customPage", component: CustomPage },
|
|
|
|
|
|
|
|
|
|
// Recipe Page
|
|
|
|
|
{
|
|
|
|
|
path: "/recipe/:recipe",
|
|
|
|
|
component: ViewRecipe,
|
|
|
|
|
meta: {
|
|
|
|
|
title: async route => {
|
2021-06-13 14:07:58 -08:00
|
|
|
const [response, error] = await api.recipes.requestDetails(route.params.recipe);
|
|
|
|
|
if (error) console.log({ error });
|
2021-06-12 22:23:23 -08:00
|
|
|
const recipe = response.data;
|
2021-06-13 03:46:31 +08:00
|
|
|
if (recipe && recipe.name) return recipe.name;
|
|
|
|
|
else return null;
|
2021-04-21 21:52:12 -08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|