1
0

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:
2025-07-18 15:06:21 +09:00
parent 00b4b8f21e
commit 0d745e2174
3 changed files with 58 additions and 15 deletions

View File

@@ -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;