Fixed reports queries.

This commit is contained in:
Mike Cao 2024-01-30 02:10:23 -08:00
parent 40970f6c33
commit 87bb9b1e73
5 changed files with 21 additions and 13 deletions

View file

@ -6,11 +6,9 @@ export function useReports({ websiteId, teamId }: { websiteId?: string; teamId?:
const modified = useCache((state: any) => state?.reports);
const { get, del, useMutation } = useApi();
const queryResult = useFilterQuery({
queryKey: ['reports', { websiteId, modified }],
queryKey: ['reports', { websiteId, teamId, modified }],
queryFn: (params: any) => {
const url = websiteId ? `/websites/${websiteId}/reports` : `/reports`;
return get(teamId ? `/teams/${teamId}${url}` : url, params);
return get('/reports', { websiteId, teamId, ...params });
},
});
const { mutate } = useMutation({ mutationFn: (reportId: string) => del(`/reports/${reportId}`) });

View file

@ -29,9 +29,6 @@ export function ProfileButton() {
<Icon>
<Icons.Profile />
</Icon>
<Icon size="sm">
<Icons.ChevronDown />
</Icon>
</Button>
<Popup position="bottom" alignment={dir === 'rtl' ? 'start' : 'end'}>
<Menu onSelect={handleSelect} className={styles.menu}>

View file

@ -63,6 +63,7 @@ export function ListTable({
{data?.length === 0 && <Empty className={styles.empty} />}
{virtualize && data.length > 0 ? (
<FixedSizeList
width="100%"
height={itemCount * ITEM_SIZE}
itemCount={data.length}
itemSize={ITEM_SIZE}