mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 17:45:38 +01:00
Added teams pages. Refactored hooks.
This commit is contained in:
parent
a2c202fa36
commit
9448aa3ab5
136 changed files with 387 additions and 287 deletions
|
|
@ -1,14 +1,12 @@
|
|||
'use client';
|
||||
import { ReactNode, useContext } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import WebsitesTable from 'app/(main)/settings/websites/WebsitesTable';
|
||||
import useApi from 'components/hooks/useApi';
|
||||
import DataTable from 'components/common/DataTable';
|
||||
import useFilterQuery from 'components/hooks/useFilterQuery';
|
||||
import useCache from 'store/cache';
|
||||
import SettingsContext from '../SettingsContext';
|
||||
import useWebsites from 'components/hooks/queries/useWebsites';
|
||||
|
||||
export interface WebsitesDataTableProps {
|
||||
userId: string;
|
||||
userId?: string;
|
||||
teamId?: string;
|
||||
allowEdit?: boolean;
|
||||
allowView?: boolean;
|
||||
showActions?: boolean;
|
||||
|
|
@ -17,24 +15,13 @@ export interface WebsitesDataTableProps {
|
|||
|
||||
export function WebsitesDataTable({
|
||||
userId,
|
||||
teamId,
|
||||
allowEdit = true,
|
||||
allowView = true,
|
||||
showActions = true,
|
||||
children,
|
||||
}: WebsitesDataTableProps) {
|
||||
const { get } = useApi();
|
||||
const modified = useCache((state: any) => state?.websites);
|
||||
const { websitesUrl } = useContext(SettingsContext);
|
||||
|
||||
const queryResult = useFilterQuery({
|
||||
queryKey: ['websites', { modified }],
|
||||
queryFn: (params: any) => {
|
||||
return get(websitesUrl, {
|
||||
...params,
|
||||
});
|
||||
},
|
||||
enabled: !!userId,
|
||||
});
|
||||
const queryResult = useWebsites({ userId, teamId });
|
||||
|
||||
return (
|
||||
<DataTable queryResult={queryResult}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue