feat: refactor category update functionality

This commit is contained in:
Ardeman
2025-03-08 01:32:25 +08:00
parent 2c64d430bd
commit c975169f05
6 changed files with 53 additions and 33 deletions
@@ -4,11 +4,11 @@ import { FormContentsPage } from '~/pages/form-contents'
import type { Route } from './+types/_admin.lg-admin._dashboard.contents.update.$slug'
export const loader = async ({ request }: Route.LoaderArgs) => {
export const loader = async ({ request, params }: Route.LoaderArgs) => {
const { staffToken } = await handleCookie(request)
const { data: newsData } = await getNewsBySlug({
accessToken: staffToken,
slug: request.url.split('/').pop() ?? '',
slug: params.slug,
})
return { newsData }
}