feat(frontend-v2): ProfilePage 接 profile API - client/useApi/App 对齐真实契约 (#987-#990)

This commit is contained in:
QihuAI Design committed 2026-08-23 12:30:20 +08:00
1 parent 8a9c2e4868
commit 09440c2577
2 files changed
+38 -17

No files matched your search

+36 -1
View File
@@ -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