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 { getTags } from '~/apis/common/get-tags'
|
||||||
import { handleCookie } from '~/libs/cookies'
|
|
||||||
import { FormTagPage } from '~/pages/form-tag'
|
import { FormTagPage } from '~/pages/form-tag'
|
||||||
|
|
||||||
import type { Route } from './+types/_admin.lg-admin._dashboard.tags.update.$id'
|
import type { Route } from './+types/_admin.lg-admin._dashboard.tags.update.$id'
|
||||||
|
|
||||||
export const loader = async ({ request, params }: Route.LoaderArgs) => {
|
export const loader = async ({ params }: Route.LoaderArgs) => {
|
||||||
const { staffToken } = await handleCookie(request)
|
const { data: tagsData } = await getTags()
|
||||||
const { data: tagsData } = await getTags({
|
|
||||||
accessToken: staffToken,
|
|
||||||
})
|
|
||||||
const tagData = tagsData.find((tag) => tag.id === params.id)
|
const tagData = tagsData.find((tag) => tag.id === params.id)
|
||||||
return { tagData }
|
return { tagData }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user