Update article page to display related media outlet information

Modify article API response to include nested media outlet data and update client-side data fetching in Article.tsx to directly access outlet information from the article data, simplifying the component's data loading logic.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9a264234-c5d7-4dcc-adf3-a954b149b30d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/9a264234-c5d7-4dcc-adf3-a954b149b30d/uCJPlBt
This commit is contained in:
kimjaehyeon0101
2025-10-15 05:22:29 +00:00
parent 1c859e461c
commit 31150e5a34
3 changed files with 7 additions and 11 deletions

View File

@ -100,7 +100,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
if (!article) {
return res.status(404).json({ message: "Article not found" });
}
res.json(article);
const allOutlets = await storage.getMediaOutlets();
const outlet = allOutlets.find(o => o.id === article.mediaOutletId);
res.json({ ...article, outlet });
} catch (error) {
console.error("Error fetching article:", error);
res.status(500).json({ message: "Failed to fetch article" });