import { createApp } from 'vue' import { createRouter, createWebHashHistory } from 'vue-router' import App from './App.vue' import LoginPage from './components/LoginPage.vue' import RecipesPage from './components/recipes/RecipesPage.vue' import MealPlanPage from './components/meals/MealPlanPage.vue' import MyShoppingPage from './components/shopping/MyShoppingPage.vue' import PurchasedShoppingListPage from './components/shopping/PurchasedShoppingListPage.vue' import CurrentShoppingListPage from './components/shopping/CurrentShoppingListPage.vue' import EditMealPage from './components/meals/EditMealPage.vue' import EditRecipePage from './components/recipes/EditRecipePage.vue' // 2. Define some routes // Each route should map to a component. // We'll talk about nested routes later. const routes = [ // Redirect index to mealplan { path: '/', redirect: '/mealplan' }, { path: '/mealplan', component: MealPlanPage }, { path: '/login', component: LoginPage }, { path: '/shopping', component: MyShoppingPage }, { path: '/shopping/current', component: CurrentShoppingListPage }, { path: '/shopping/:id', component: PurchasedShoppingListPage, props : true }, { path: '/recipes', component: RecipesPage }, { path: '/recipes/add', component: EditRecipePage }, { path: '/recipes/:id', component: EditRecipePage, props: true }, { path: '/meals/add', component: EditMealPage }, { path: '/meals/:id', component: EditMealPage, props: true }, ] // 3. Create the router instance and pass the `routes` option // You can pass in additional options here, but let's // keep it simple for now. const router = createRouter({ // 4. Provide the history implementation to use. We are using the hash history for simplicity here. history: createWebHashHistory(), routes, // short for `routes: routes` }) // 5. Create and mount the root instance. const app = createApp(App) // Make sure to _use_ the router instance to make the // whole app router-aware. app.use(router) app.mount('#app') // Now the app has started!