Refactored useQuery functions.

This commit is contained in:
Mike Cao 2023-12-01 20:27:59 -08:00
parent be550cc440
commit b578162cb6
33 changed files with 179 additions and 151 deletions

View file

@ -14,7 +14,10 @@ const reports = {
export default function ReportDetails({ reportId }) {
const { get, useQuery } = useApi();
const { data: report } = useQuery(['reports', reportId], () => get(`/reports/${reportId}`));
const { data: report } = useQuery({
queryKey: ['reports', reportId],
queryFn: () => get(`/reports/${reportId}`),
});
if (!report) {
return null;