style: fix linter issues and data location

This commit is contained in:
Diana Olarte
2025-09-26 15:24:06 +10:00
committed by Adolfo R. Brandes
parent 651ded21a7
commit 727bf74049
14 changed files with 78 additions and 75 deletions

View File

@@ -0,0 +1,37 @@
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
import { LibraryMetadata, TeamMember } from '@src/types';
import { getLibrary, getTeamMembers } from './api';
/**
* React Query hook to fetch all team members for a specific object/scope.
* It retrieves the full list of members who have access to the given scope.
*
* @param object - The unique identifier of the object/scope
*
* @example
* ```tsx
* const { data: teamMembers, isLoading, isError } = useTeamMembers('lib:123');
* ```
*/
export const useTeamMembers = (object: string) => useQuery<TeamMember[], Error>({
queryKey: ['team-members', object],
queryFn: () => getTeamMembers(object),
staleTime: 1000 * 60 * 30, // refetch after 30 minutes
});
/**
* React Query hook to retrieve the information of the current library.
*
* @param libraryId - The unique ID of the library.
*
* @example
* const { data } = useLibrary('lib:123',);
*
*/
export const useLibrary = (libraryId: string) => {
return useSuspenseQuery<LibraryMetadata, Error>({
queryKey: ['library-metadata', libraryId],
queryFn: () => getLibrary(libraryId),
retry: false,
});
}