feat: implement category fetching and integrate into header menus

This commit is contained in:
Ardeman
2025-03-02 12:06:30 +08:00
parent cfc864cb43
commit 25e136ba72
5 changed files with 48 additions and 44 deletions
+3
View File
@@ -1,5 +1,6 @@
import { Outlet } from 'react-router'
import { getCategories } from '~/apis/common/get-categories'
import { getSubscriptions } from '~/apis/common/get-subscriptions'
import { NewsProvider } from '~/contexts/news'
import { NewsDefaultLayout } from '~/layouts/news/default'
@@ -10,10 +11,12 @@ import type { Route } from './+types/_layout'
export const loader = async ({ request }: Route.LoaderArgs) => {
const { userToken } = await handleCookie(request)
const { data: subscriptionsData } = await getSubscriptions()
const { data: categoriesData } = await getCategories()
return {
userToken,
subscriptionsData,
categoriesData,
}
}