2018-03-29 01:57:00 -05:00
|
|
|
import Vue from 'vue';
|
|
|
|
import Router from 'vue-router';
|
|
|
|
|
|
|
|
import The404Page from './components/The404Page';
|
2018-03-30 14:31:09 -05:00
|
|
|
import TheAboutPage from './components/TheAboutPage';
|
|
|
|
import TheCalculator from './components/TheCalculator';
|
2018-04-13 10:25:18 -05:00
|
|
|
|
|
|
|
import TheLog from './components/TheLog';
|
|
|
|
import TheLogList from './components/TheLogList';
|
|
|
|
import TheLogCreator from './components/TheLogCreator';
|
|
|
|
import TheLogEditor from './components/TheLogEditor';
|
|
|
|
|
2018-03-30 14:31:09 -05:00
|
|
|
import TheIngredientList from './components/TheIngredientList';
|
2018-04-02 00:10:06 -05:00
|
|
|
import TheIngredient from "./components/TheIngredient";
|
|
|
|
import TheIngredientEditor from "./components/TheIngredientEditor";
|
|
|
|
import TheIngredientCreator from "./components/TheIngredientCreator";
|
2018-03-30 14:31:09 -05:00
|
|
|
import TheNotesList from './components/TheNotesList';
|
2018-04-01 21:43:23 -05:00
|
|
|
import TheRecipe from './components/TheRecipe';
|
|
|
|
import TheRecipeEditor from './components/TheRecipeEditor';
|
|
|
|
import TheRecipeCreator from './components/TheRecipeCreator';
|
2018-03-29 01:57:00 -05:00
|
|
|
import TheRecipeList from './components/TheRecipeList';
|
|
|
|
|
|
|
|
Vue.use(Router);
|
|
|
|
|
2018-04-01 12:17:54 -05:00
|
|
|
const router = new Router({
|
|
|
|
routes: []
|
|
|
|
});
|
|
|
|
|
|
|
|
router.addRoutes(
|
|
|
|
[
|
2018-03-29 01:57:00 -05:00
|
|
|
{
|
|
|
|
path: '/',
|
2018-04-01 21:43:23 -05:00
|
|
|
redirect: '/recipes'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/recipes',
|
2018-03-29 01:57:00 -05:00
|
|
|
name: 'recipeList',
|
|
|
|
component: TheRecipeList
|
|
|
|
},
|
2018-04-01 21:43:23 -05:00
|
|
|
{
|
|
|
|
path: '/recipes/new',
|
|
|
|
name: 'new_recipe',
|
|
|
|
component: TheRecipeCreator
|
|
|
|
},
|
2018-03-30 14:31:09 -05:00
|
|
|
{
|
|
|
|
path: '/recipes/:id/edit',
|
|
|
|
name: 'edit_recipe',
|
2018-04-01 21:43:23 -05:00
|
|
|
component: TheRecipeEditor
|
2018-03-30 14:31:09 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/recipe/:id',
|
|
|
|
name: 'recipe',
|
2018-04-01 21:43:23 -05:00
|
|
|
component: TheRecipe
|
2018-03-30 14:31:09 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/about",
|
|
|
|
name: "about",
|
|
|
|
component: TheAboutPage
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/calculator",
|
|
|
|
name: "calculator",
|
|
|
|
component: TheCalculator
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/ingredients",
|
|
|
|
name: "ingredients",
|
|
|
|
component: TheIngredientList
|
|
|
|
},
|
2018-04-02 00:10:06 -05:00
|
|
|
{
|
|
|
|
path: "/ingredients/new",
|
|
|
|
name: "new_ingredient",
|
|
|
|
component: TheIngredientCreator
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/ingredients/:id/edit",
|
|
|
|
name: "edit_ingredient",
|
|
|
|
component: TheIngredientEditor
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/ingredients/:id",
|
|
|
|
name: "ingredient",
|
|
|
|
component: TheIngredient
|
|
|
|
},
|
2018-04-13 10:25:18 -05:00
|
|
|
{
|
|
|
|
path: "/logs",
|
|
|
|
name: "logs",
|
|
|
|
component: TheLogList
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/recipes/:recipeId/logs/new",
|
|
|
|
name: "new_log",
|
|
|
|
component: TheLogCreator
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/logs/:id/edit",
|
|
|
|
name: "edit_log",
|
|
|
|
component: TheLogEditor
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/logs/:id",
|
|
|
|
name: "log",
|
|
|
|
component: TheLog
|
|
|
|
},
|
2018-03-30 14:31:09 -05:00
|
|
|
{
|
|
|
|
path: "/notes",
|
|
|
|
name: "notes",
|
|
|
|
component: TheNotesList
|
|
|
|
},
|
2018-04-01 12:17:54 -05:00
|
|
|
{
|
|
|
|
path: "/logout",
|
|
|
|
name: "logout",
|
|
|
|
beforeEnter: (to, from, next) => {
|
|
|
|
const $store = router.app.$store;
|
|
|
|
$store.dispatch("logout")
|
|
|
|
.then(() => next("/"));
|
|
|
|
}
|
|
|
|
},
|
2018-03-29 01:57:00 -05:00
|
|
|
{
|
|
|
|
path: '*',
|
|
|
|
component: The404Page
|
|
|
|
}
|
|
|
|
]
|
2018-04-01 12:17:54 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
export default router;
|