- Create code-first route tree in src/app/routing/routeTree.tsx - Replace ProtectedRoute with beforeLoad auth guards - Add useSearchParamsCompat for URLSearchParams access - Update App.tsx, layouts, and all page/widget imports - Add frontend tooling: biome, prettier, env config - Update all tests for TanStack Router compatibility - Remove react-router-dom dependency, @tanstack/router-plugin - Consolidate biome config at root level
18 lines
550 B
TypeScript
18 lines
550 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import type { AnalyticsResponse } from '@/shared/api/responses'
|
|
import { getPortfolioAnalytics } from '../api/portfolioApi'
|
|
|
|
export function usePortfolioAnalytics(portfolioId: number) {
|
|
return useQuery<AnalyticsResponse>({
|
|
queryKey: ['portfolio', portfolioId, 'analytics'],
|
|
queryFn: async () => {
|
|
const res = await getPortfolioAnalytics(portfolioId)
|
|
return res.data
|
|
},
|
|
staleTime: 900_000,
|
|
retry: 2,
|
|
refetchOnWindowFocus: false,
|
|
enabled: !!portfolioId,
|
|
})
|
|
}
|