feat: implement clientLoader for news data fetching and update serverLoader structure

This commit is contained in:
Ardeman
2025-03-19 17:46:26 +08:00
parent 4ca2d8cf84
commit ba4e380023
2 changed files with 40 additions and 12 deletions
+4 -2
View File
@@ -4,11 +4,13 @@ import { Card } from '~/components/ui/card'
import { CarouselHero } from '~/components/ui/carousel-hero'
import { CarouselSection } from '~/components/ui/carousel-section'
import { Newsletter } from '~/components/ui/newsletter'
import type { loader } from '~/routes/_news._index'
import { type clientLoader } from '~/routes/_news._index'
import type { TNews } from '~/types/news'
export const NewsPage = () => {
const loaderData = useRouteLoaderData<typeof loader>('routes/_news._index')
const loaderData = useRouteLoaderData<typeof clientLoader>(
'routes/_news._index',
)
const spotlight: TNews = {
title: loaderData?.spotlightCategory?.name || '',
description: loaderData?.spotlightCategory?.description || '',