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:
Patrick Plate
2026-06-12 20:24:11 +02:00
parent be63a84fe8
commit ed1efccc90
5 changed files with 467 additions and 123 deletions
+18 -1
View File
@@ -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,
}),
})
}