Fixing author page load times

This commit is contained in:
Stefan Hardegger
2026-03-27 14:30:30 +01:00
parent f2443ae664
commit 5780493623
2 changed files with 8 additions and 7 deletions

View File

@@ -26,15 +26,11 @@ export default function AuthorDetailPage() {
setLoading(true);
const [authorData, storiesResult] = await Promise.all([
authorApi.getAuthor(authorId),
storyApi.getStories({ page: 0, size: 1000 }) // Get all stories to filter by author
storyApi.getStoriesByAuthor(authorId, { page: 0, size: 100 })
]);
setAuthor(authorData);
// Filter stories by this author
const authorStories = storiesResult.content.filter(
story => story.authorId === authorId
);
setStories(authorStories);
setStories(storiesResult.content);
} catch (error) {
console.error('Failed to load author data:', error);
router.push('/authors');