создаю телегу товаров
All checks were successful
Deploy / build (push) Successful in 43s

This commit is contained in:
alsaze
2025-09-26 23:17:53 +03:00
parent 7c811a4841
commit 83d2a56e52
7 changed files with 138 additions and 26 deletions

View File

@@ -1,9 +1,16 @@
<template>
<div class="cart">
<div v-if="cartProducts">
{{ cartProducts }}
<div class="cart__items">
<div
v-for="cartItem in cart?.line_items"
:key="cartItem.variation_id"
>
<CartItem :cart-item="cartItem" />
</div>
</div>
</div>
<div>
<UButton @click="createOrder">
Оформить заказ
</UButton>
@@ -13,15 +20,23 @@
<script setup lang="ts">
import { usePostOrdersCreate } from '~/api/mutations'
const { getCart } = useCart()
const cartProducts = getCart()
const { cart } = useCart()
const { mutateAsync } = usePostOrdersCreate()
const createOrder = () => {
mutateAsync(cartProducts)
mutateAsync(cart)
}
</script>
<style lang="scss">
.cart {
display: flex;
flex-direction: row;
justify-content: space-between;
&__items {
display: flex;
flex-direction: column;
}
}
</style>