diff --git a/web/app/orders/[id]/page.tsx b/web/app/orders/[id]/page.tsx index 481bf36..4b6d4ff 100644 --- a/web/app/orders/[id]/page.tsx +++ b/web/app/orders/[id]/page.tsx @@ -1,46 +1,46 @@ -"use client"; - -import { useParams } from "next/navigation"; -import { useEffect, useState } from "react"; - -import type { Order } from "@/lib/types"; - -export default function OrderPage() { - const params = useParams<{ id: string }>(); - const [order, setOrder] = useState(null); - const [error, setError] = useState(""); - - useEffect(() => { - void (async () => { - const response = await fetch(`/backend/orders/${params.id}`, { credentials: "include", cache: "no-store" }); - if (!response.ok) { - setError("Заказ не найден"); - return; - } - setOrder(await response.json()); - })(); - }, [params.id]); - - if (error) { - return

{error}

; - } - if (!order) { - return

Загрузка…

; - } - - return ( - <> -

Заказ {order.id}

-

Статус: создан, без оплаты.

-

- {order.customer_name}, {order.customer_phone} -

- {order.items.map((item) => ( -

- {item.title} × {item.qty} — {item.price} ₽ -

- ))} -

Итого: {order.total} ₽

- - ); -} +"use client"; + +import { useParams } from "next/navigation"; +import { useEffect, useState } from "react"; + +import type { Order } from "@/lib/types"; + +export default function OrderPage() { + const params = useParams<{ id: string }>(); + const [order, setOrder] = useState(null); + const [error, setError] = useState(""); + + useEffect(() => { + void (async () => { + const response = await fetch(`/backend/orders/${params.id}`, { credentials: "include", cache: "no-store" }); + if (!response.ok) { + setError("Заказ не найден"); + return; + } + setOrder(await response.json()); + })(); + }, [params.id]); + + if (error) { + return

{error}

; + } + if (!order) { + return

Загрузка...

; + } + + return ( + <> +

Заказ {order.id}

+

Статус: создан, без оплаты.

+

+ {order.customer_name}, {order.customer_phone} +

+ {order.items.map((item) => ( +

+ {item.title} x {item.qty} - {item.price} руб. +

+ ))} +

Итого: {order.total} руб.

+ + ); +}