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:
@ -19,15 +19,13 @@ export default function Article() {
|
||||
const { user } = useAuth();
|
||||
const [betAmounts, setBetAmounts] = useState<Record<string, string>>({});
|
||||
|
||||
const { data: article, isLoading: articleLoading } = useQuery<Article>({
|
||||
const { data: articleData, isLoading: articleLoading } = useQuery<Article & { outlet?: MediaOutlet }>({
|
||||
queryKey: ["/api/articles", params?.slug],
|
||||
enabled: !!params?.slug
|
||||
});
|
||||
|
||||
const { data: outlet, isLoading: outletLoading } = useQuery<MediaOutlet>({
|
||||
queryKey: ["/api/media-outlets", article?.mediaOutletId],
|
||||
enabled: !!article?.mediaOutletId
|
||||
});
|
||||
const article = articleData;
|
||||
const outlet = articleData?.outlet;
|
||||
|
||||
const { data: markets = [], isLoading: marketsLoading } = useQuery<PredictionMarket[]>({
|
||||
queryKey: ["/api/articles", params?.slug, "markets"],
|
||||
@ -113,7 +111,7 @@ export default function Article() {
|
||||
return parts;
|
||||
};
|
||||
|
||||
if (articleLoading || outletLoading) {
|
||||
if (articleLoading) {
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<header className="bg-white border-b border-gray-200 sticky top-0 z-50">
|
||||
|
||||
Reference in New Issue
Block a user