refactor: move spa to frontend folder
This commit is contained in:
43
frontend/spa/src/router.js
Normal file
43
frontend/spa/src/router.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import {createRouter, createWebHashHistory} from 'vue-router';
|
||||
import Home from './views/Home.vue';
|
||||
import Product from './views/Product.vue';
|
||||
import CategoriesList from "./views/CategoriesList.vue";
|
||||
import Cart from "./views/Cart.vue";
|
||||
import Products from "@/views/Products.vue";
|
||||
import Checkout from "@/views/Checkout.vue";
|
||||
import OrderCreated from "@/views/OrderCreated.vue";
|
||||
import Search from "@/views/Search.vue";
|
||||
import Filters from "@/views/Filters.vue";
|
||||
import {useYaMetrikaStore} from "@/stores/yaMetrikaStore.js";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
},
|
||||
{path: '/filters', name: 'filters', component: Filters},
|
||||
{path: '/product/:id', name: 'product.show', component: Product},
|
||||
{
|
||||
path: '/products/:category_id',
|
||||
name: 'product.categories.show',
|
||||
component: Products,
|
||||
},
|
||||
{path: '/categories', name: 'categories', component: CategoriesList},
|
||||
{path: '/category/:id', name: 'category.show', component: CategoriesList},
|
||||
{path: '/cart', name: 'cart', component: Cart},
|
||||
{path: '/checkout', name: 'checkout', component: Checkout},
|
||||
{path: '/success', name: 'order_created', component: OrderCreated},
|
||||
{path: '/search', name: 'search', component: Search},
|
||||
];
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHashHistory('/image/catalog/tgshopspa/'),
|
||||
routes,
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
const ym = useYaMetrikaStore();
|
||||
ym.prevPath = from.path;
|
||||
next();
|
||||
});
|
||||
Reference in New Issue
Block a user