feat(frontend-v2): ProfilePage 接 profile API - client/useApi/App 对齐真实契约 (#987-#990)
This commit is contained in:
1 parent
8a9c2e4868
commit
09440c2577
2 files changed
+38
-17
No files matched your search
+2
-16
@@ -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() {
|
||||
}
|
||||
/>
|
||||
<Route path="dashboard" element={<DashboardPage />} />
|
||||
<Route
|
||||
path="profile"
|
||||
element={
|
||||
<ComingSoon
|
||||
title="个人中心"
|
||||
icon={User}
|
||||
description="管理个人账户、余额与偏好设置。"
|
||||
features={[
|
||||
'账户资料与登录安全',
|
||||
'Token 余额与充值',
|
||||
'API Key 与偏好配置',
|
||||
]}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route path="profile" element={<ProfilePage />} />
|
||||
<Route
|
||||
path="notifications"
|
||||
element={
|
||||
|
||||
@@ -189,11 +189,46 @@ export function useProfile() {
|
||||
export function useUpdateProfile() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (data: Record<string, unknown>) => profileApi.update(data),
|
||||
mutationFn: (data: Parameters<typeof profileApi.update>[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
|
||||
|
||||
Reference in new issue
Block a user