Merge remote-tracking branch 'origin/master' into feature/slicing

This commit is contained in:
fredy.siswanto
2025-03-07 13:19:50 +07:00
5 changed files with 61 additions and 15 deletions
@@ -1,4 +1,20 @@
import { getNewsBySlug } from '~/apis/common/get-news-by-slug'
import { handleCookie } from '~/libs/cookies'
import { ContentsFormPage } from '~/pages/contents-form'
const DashboardContentUpdateLayout = () => <ContentsFormPage />
import type { Route } from './+types/_admin.lg-admin._dashboard.contents.update.$slug'
export const loader = async ({ request }: Route.LoaderArgs) => {
const { staffToken } = await handleCookie(request)
const { data: newsData } = await getNewsBySlug({
accessToken: staffToken,
slug: request.url.split('/').pop() ?? '',
})
return { newsData }
}
const DashboardContentUpdateLayout = ({ loaderData }: Route.ComponentProps) => {
const newsData = loaderData.newsData
return <ContentsFormPage newsData={newsData} />
}
export default DashboardContentUpdateLayout