munch-ease-frontend/src/main.js

45 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-01-07 02:40:35 +00:00
import { createApp } from 'vue'
2024-01-13 02:00:15 +00:00
import { createRouter, createWebHashHistory } from 'vue-router'
2024-01-07 02:40:35 +00:00
import App from './App.vue'
2024-04-28 02:13:49 +00:00
import LoginPage from './components/LoginPage.vue'
import RecipesPage from './components/RecipesPage.vue'
2024-01-13 02:00:15 +00:00
import MealPlanPage from './components/MealPlanPage.vue'
import ShoppingPage from './components/ShoppingPage.vue'
import EditMealPage from './components/EditMealPage.vue'
import EditRecipePage from './components/EditRecipePage.vue'
// 2. Define some routes
// Each route should map to a component.
// We'll talk about nested routes later.
const routes = [
{ path: '/', component: MealPlanPage },
2024-01-13 02:00:15 +00:00
{ path: '/mealplan', component: MealPlanPage },
{ path: '/login', component: LoginPage },
2024-01-13 02:00:15 +00:00
{ path: '/shopping', component: ShoppingPage },
{ path: '/recipes', component: RecipesPage },
2024-01-13 02:00:15 +00:00
{ path: '/recipes/add', component: EditRecipePage },
2024-01-13 07:00:55 +00:00
{ path: '/recipes/:id', component: EditRecipePage, props: true },
2024-01-13 23:09:15 +00:00
{ path: '/meals/add', component: EditMealPage },
{ path: '/meals/:id', component: EditMealPage, props: true },
2024-01-13 02:00:15 +00:00
]
// 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!