From 09440c2577a18c5719e9fd891c97dbaa915a3a89 Mon Sep 17 00:00:00 2001 From: QihuAI Design Date: Sun, 23 Aug 2026 12:30:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend-v2):=20ProfilePage=20=E6=8E=A5=20?= =?UTF-8?q?profile=20API=20-=20client/useApi/App=20=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E7=9C=9F=E5=AE=9E=E5=A5=91=E7=BA=A6=20(#987-#990)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend-v2/src/App.tsx | 18 ++-------------- frontend-v2/src/hooks/useApi.ts | 37 ++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/frontend-v2/src/App.tsx b/frontend-v2/src/App.tsx index 2aae59f..73a295c 100644 --- a/frontend-v2/src/App.tsx +++ b/frontend-v2/src/App.tsx @@ -9,6 +9,7 @@ import { KnowledgePage } from '@/pages/front/KnowledgePage'; import { ImBotHub } from '@/pages/front/ImBotHub'; import { AppServices } from '@/pages/front/AppServices'; import { DashboardPage } from '@/pages/front/DashboardPage'; +import { ProfilePage } from '@/pages/front/ProfilePage'; import { ComingSoon } from '@/components/common/ComingSoon'; import { Zap, @@ -17,7 +18,6 @@ import { Workflow, Shield, Radio, - User, Bell, Sparkles, } from 'lucide-react'; @@ -126,21 +126,7 @@ function App() { } /> } /> - - } - /> + } /> ) => profileApi.update(data), + mutationFn: (data: Parameters[0]) => profileApi.update(data), onSuccess: () => qc.invalidateQueries({ queryKey: ['profile'] }), }); } +export function useProfileBalance() { + return useQuery({ + queryKey: ['profile', 'balance'], + queryFn: profileApi.getBalance, + }); +} + +export function useProfileMembership() { + return useQuery({ + queryKey: ['profile', 'membership'], + queryFn: profileApi.getMembership, + }); +} + +export function useProfileLoginLogs(page = 1, page_size = 10) { + return useQuery({ + queryKey: ['profile', 'login-logs', page, page_size], + queryFn: () => profileApi.getLoginLogs(page, page_size), + }); +} + +export function useProfileApiKeys() { + return useQuery({ + queryKey: ['profile', 'api-keys'], + queryFn: profileApi.getApiKeys, + }); +} + +export function useProfilePurchasedApps() { + return useQuery({ + queryKey: ['profile', 'purchased-apps'], + queryFn: profileApi.getPurchasedApps, + }); +} + // ─── Token 驾驶舱 ───────────────────────────────────────────────────────────────── // Landing hero still shows a few headline numbers; reuse the real token overview