From 9b1cbc03002c8c9f9805bde32463b402a2ec3a44 Mon Sep 17 00:00:00 2001 From: Redsandyg Date: Tue, 3 Jun 2025 10:57:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=D0=B0=D0=BA=D0=BA=D0=B0=D1=83=D0=BD=D1=82=D0=B0=20=D1=81=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=BE=D0=B9=20=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7?= =?UTF-8?q?=20API,=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=B8=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BE=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/account/page.tsx | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/app/account/page.tsx diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx new file mode 100644 index 0000000..d3d9507 --- /dev/null +++ b/src/app/account/page.tsx @@ -0,0 +1,50 @@ +"use client"; +import { useEffect, useState } from "react"; +import styles from "../../styles/dashboard.module.css"; + +interface AccountData { + id: number; + login: string; + name: string | null; + email: string | null; + balance: number; +} + +export default function AccountPage() { + const [account, setAccount] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + fetch("/api/account") + .then((res) => { + if (!res.ok) throw new Error("Ошибка загрузки данных аккаунта"); + return res.json(); + }) + .then((data) => { + setAccount(data); + setLoading(false); + }) + .catch((err) => { + setError(err.message); + setLoading(false); + }); + }, []); + + if (loading) return
Загрузка...
; + if (error) return
Ошибка: {error}
; + if (!account) return
Нет данных
; + + return ( +
+

Аккаунт

+
+
ID: {account.id}
+
Логин: {account.login}
+
Имя: {account.name || "-"}
+
Email: {account.email || "-"}
+
Баланс: {account.balance.toLocaleString("ru-RU", { style: "currency", currency: "RUB" })}
+
+
+ ); +} \ No newline at end of file