Preserve local user table for superDream-specific features while syncing user lifecycle, API key CRUD and usage queries through sub2api. Admin token handles reads and user lifecycle; per-user tokens (Fernet-encrypted in DB) handle key writes that admin endpoints do not expose. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
947 B
TypeScript
27 lines
947 B
TypeScript
import { useState, useEffect } from "react";
|
||
import { authService, UserInfo } from "../../services/authService";
|
||
|
||
export default function Wallet() {
|
||
const [user, setUser] = useState<UserInfo | null>(null);
|
||
|
||
useEffect(() => {
|
||
authService.me().then(setUser).catch(() => {});
|
||
}, []);
|
||
|
||
return (
|
||
<div>
|
||
<h2 className="text-xl font-bold text-gray-900 dark:text-white mb-4">钱包</h2>
|
||
|
||
<div className="bg-superdream-panel rounded-xl p-6 mb-4">
|
||
<p className="text-gray-600 dark:text-gray-400 text-sm">当前余额 (USD)</p>
|
||
<p className="text-3xl font-bold text-gray-900 dark:text-white mt-1">
|
||
${(user?.balance ?? 0).toFixed(4)}
|
||
</p>
|
||
</div>
|
||
|
||
<div className="bg-superdream-panel rounded-xl p-4 text-sm text-gray-600 dark:text-gray-400">
|
||
兑换码充值和交易记录暂未对接 sub2api,后续接入 <code>/api/v1/redeem</code> 后恢复。
|
||
</div>
|
||
</div>
|
||
);
|
||
} |