mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 01:25:37 +01:00
Refactored useQuery functions.
This commit is contained in:
parent
be550cc440
commit
b578162cb6
33 changed files with 179 additions and 151 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ export function DashboardEdit() {
|
|||
const { formatMessage, labels } = useMessages();
|
||||
const [order, setOrder] = useState(websiteOrder || []);
|
||||
const { get, useQuery } = useApi();
|
||||
const { data: result } = useQuery(['websites'], () => get('/websites', { includeTeams: 1 }));
|
||||
const { data: result } = useQuery({
|
||||
queryKey: ['websites'],
|
||||
queryFn: () => get('/websites', { includeTeams: 1 }),
|
||||
});
|
||||
const { data: websites } = result || {};
|
||||
|
||||
const ordered = useMemo(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue