Updated profile menu. Fixed dashboard.

This commit is contained in:
Mike Cao 2024-02-02 21:06:55 -08:00
parent a91b9c9716
commit 400657d59e
12 changed files with 73 additions and 70 deletions

View file

@ -1,5 +1,6 @@
import useApi from './useApi';
import useFilterQuery from './useFilterQuery';
import { useApi } from './useApi';
import { useFilterQuery } from './useFilterQuery';
import { useLogin } from './useLogin';
import useCache from 'store/cache';
export function useWebsites(
@ -7,17 +8,17 @@ export function useWebsites(
params?: { [key: string]: string | number },
) {
const { get } = useApi();
const { user } = useLogin();
const modified = useCache((state: any) => state?.websites);
return useFilterQuery({
queryKey: ['websites', { userId, teamId, modified, ...params }],
queryFn: (data: any) => {
return get(teamId ? `/teams/${teamId}/websites` : `/users/${userId}/websites`, {
return get(teamId ? `/teams/${teamId}/websites` : `/users/${userId || user.id}/websites`, {
...data,
...params,
});
},
enabled: !!(userId || teamId),
});
}