refactor: simplify loader function by removing cookie handling in tag update route
This commit is contained in:
parent
4554cca392
commit
687e3c8d01
@ -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 }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user