Fix: useContactFolders handle paginated response (items wrapper)
This commit is contained in:
@@ -63,7 +63,10 @@ export function useDeleteContact() {
|
||||
export function useContactFolders() {
|
||||
return useQuery({
|
||||
queryKey: ['contactFolders'],
|
||||
queryFn: () => apiGet<ContactFolder[]>('/contact-folders'),
|
||||
queryFn: async () => {
|
||||
const res = await apiGet<ContactFolder[] | { items: ContactFolder[] }>('/contact-folders');
|
||||
return Array.isArray(res) ? res : res.items ?? [];
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user