New goals page. Upgraded prisma.
This commit is contained in:
21
src/components/hooks/queries/useGoalsQuery.ts
Normal file
21
src/components/hooks/queries/useGoalsQuery.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { useApi } from '../useApi';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
import { useModified } from '../useModified';
|
||||
|
||||
export function useGoalsQuery(
|
||||
{ websiteId }: { websiteId: string },
|
||||
params?: { [key: string]: string | number },
|
||||
) {
|
||||
const { get } = useApi();
|
||||
const { modified } = useModified(`goals`);
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['goals', { websiteId, modified, ...params }],
|
||||
queryFn: (data: any) => {
|
||||
return get(`/websites/${websiteId}/goals`, {
|
||||
...data,
|
||||
...params,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user