Add favorite cards display on homepage
- Fetch and display users' favorite cards at the top of homepage - Filter users with fav \!== '0' to avoid empty display - Use useQueries to fetch multiple users' cards in parallel - Display cards in grid layout with owner username below - Cards are shown above the user list section 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,16 @@ export const fetchUserCards = async (userId: number, itemsPerPage = 8000): Promi
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchCardById = async (cardId: number): Promise<Card | null> => {
|
||||
try {
|
||||
const response = await api.get(`cards/${cardId}`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch card by ID:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchUser = async (userId: number): Promise<{ data: User }> => {
|
||||
const response = await api.get(`users/${userId}`);
|
||||
return response.data;
|
||||
|
Reference in New Issue
Block a user