mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +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
20
src/components/hooks/queries/useWebsites.ts
Normal file
20
src/components/hooks/queries/useWebsites.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import useApi from './useApi';
|
||||
import useFilterQuery from './useFilterQuery';
|
||||
import useCache from 'store/cache';
|
||||
|
||||
export function useWebsites({ userId, teamId }: { userId?: string; teamId?: string }) {
|
||||
const { get } = useApi();
|
||||
const modified = useCache((state: any) => state?.websites);
|
||||
|
||||
return useFilterQuery({
|
||||
queryKey: ['websites', { userId, teamId, modified }],
|
||||
queryFn: (params: any) => {
|
||||
return get(teamId ? `/teams/${teamId}/websites` : '/websites', {
|
||||
...params,
|
||||
});
|
||||
},
|
||||
enabled: !!(userId || teamId),
|
||||
});
|
||||
}
|
||||
|
||||
export default useWebsites;
|
||||
Loading…
Add table
Add a link
Reference in a new issue