"use client"; import { useEffect, useState } from "react"; import styles from "../../styles/dashboard.module.css"; import AuthGuard from "../../components/AuthGuard"; 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" })}
*/}
); }