refactor: simplify loader function by removing cookie handling in tag update route

This commit is contained in:
Ardeman 2025-03-09 09:59:55 +08:00
parent 4554cca392
commit 687e3c8d01

View File

@ -1,14 +1,10 @@
import { getTags } from '~/apis/common/get-tags'
import { handleCookie } from '~/libs/cookies'
import { FormTagPage } from '~/pages/form-tag'
import type { Route } from './+types/_admin.lg-admin._dashboard.tags.update.$id'
export const loader = async ({ request, params }: Route.LoaderArgs) => {
const { staffToken } = await handleCookie(request)
const { data: tagsData } = await getTags({
accessToken: staffToken,
})
export const loader = async ({ params }: Route.LoaderArgs) => {
const { data: tagsData } = await getTags()
const tagData = tagsData.find((tag) => tag.id === params.id)
return { tagData }
}