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

@ -20,9 +20,10 @@ export function Dashboard() {
const { get, useQuery } = useApi();
const { page, handlePageChange } = useApiFilter();
const pageSize = 10;
const { data: result, isLoading } = useQuery(['websites', page, pageSize], () =>
get('/websites', { includeTeams: 1, page, pageSize }),
);
const { data: result, isLoading } = useQuery({
queryKey: ['websites', page, pageSize],
queryFn: () => get('/websites', { includeTeams: 1, page, pageSize }),
});
const { data, count } = result || {};
const hasData = data && data?.length !== 0;