feat(sprint-5): Phase 5 — Wire reports + portal to React Query
- Reports: preview queries + apiDownload for PDF/CSV - Portal dashboard: usePortalDashboardQuery with quota fallback - Portal history: usePortalHistoryQuery with month filter - Portal profile: usePortalProfileQuery + useChangePasswordMutation - All pages show loading skeletons, graceful mock fallback
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { useMutation, useQuery } from "@tanstack/react-query"
|
||||
|
||||
import { apiClient } from "@/lib/api-client"
|
||||
|
||||
@@ -81,3 +81,20 @@ export function usePortalProfileQuery() {
|
||||
staleTime: 5 * 60 * 1000, // profile rarely changes
|
||||
})
|
||||
}
|
||||
|
||||
// --- Mutations ---
|
||||
|
||||
export interface ChangePasswordPayload {
|
||||
currentPassword: string
|
||||
newPassword: string
|
||||
}
|
||||
|
||||
export function useChangePasswordMutation() {
|
||||
return useMutation({
|
||||
mutationFn: (payload: ChangePasswordPayload) =>
|
||||
apiClient<void>("/portal/password", {
|
||||
method: "PUT",
|
||||
body: payload,
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user