diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index 3477556..4c87a39 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -5,6 +5,7 @@ import { useRoute } from "vue-router"; const route = useRoute(); const isProducts = computed(() => route.path.startsWith("/products")); +const isOrders = computed(() => route.path.startsWith("/orders")); const linkClass = (active: boolean) => [ @@ -35,6 +36,13 @@ const linkClass = (active: boolean) => Products + + Orders + + +import { onMounted, ref } from "vue"; + +const items = ref([]); +const loading = ref(true); + +onMounted(async () => { + try { + const r = await fetch("/api/orders/orders", { + headers: { Accept: "application/json" }, + }); + items.value = await r.json(); + } finally { + loading.value = false; + } +}); + + + + + + Orderss + Check all orders + + + + + v0 + + + + + Orders + + Loading… + + + + {{ p.name }} + {{ p.total_cost }} {{ p.currency }} + + + + diff --git a/src/router.ts b/src/router.ts index 71634ae..29680eb 100644 --- a/src/router.ts +++ b/src/router.ts @@ -3,6 +3,7 @@ import { createRouter, createWebHistory } from "vue-router"; import ProductsPage from "./pages/ProductsPage.vue"; import ProductDetailPage from "./pages/ProductDetailPage.vue"; import NotFoundPage from "./pages/NotFoundPage.vue"; +import OrdersPage from "./pages/OrdersPage.vue"; const router = createRouter({ history: createWebHistory(), @@ -10,6 +11,7 @@ const router = createRouter({ { path: "/", redirect: "/products" }, { path: "/products", component: ProductsPage }, { path: "/products/:id", component: ProductDetailPage, props: true }, + { path: "/orders", component: OrdersPage }, { path: "/:pathMatch(.*)*", component: NotFoundPage } ], });
Check all orders