fix: encode URI components in API calls and links to ensure proper formatting
This commit is contained in:
parent
169f0166b8
commit
54a8a97c09
@ -14,7 +14,9 @@ type TParameters = {
|
||||
export const getNewsBySlug = async (parameters: TParameters) => {
|
||||
const { slug, ...restParameters } = parameters
|
||||
try {
|
||||
const { data } = await HttpServer(restParameters).get(`/api/news/${slug}`)
|
||||
const { data } = await HttpServer(restParameters).get(
|
||||
`/api/news/${encodeURIComponent(slug)}`,
|
||||
)
|
||||
return dataResponseSchema.parse(data)
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line unicorn/no-useless-promise-resolve-reject
|
||||
|
||||
@ -83,7 +83,7 @@ export const ContentsPage = () => {
|
||||
7: (value: string) => (
|
||||
<Button
|
||||
as="a"
|
||||
href={`/lg-admin/contents/update/${value}`}
|
||||
href={`/lg-admin/contents/update/${encodeURIComponent(value)}`}
|
||||
className="text-md rounded-md"
|
||||
size="sm"
|
||||
>
|
||||
|
||||
@ -24,6 +24,6 @@ export const getPremiumAttribute = (parameters: TGetPremiumAttribute) => {
|
||||
|
||||
return {
|
||||
as: Link,
|
||||
to: `/detail/${slug}`,
|
||||
to: `/detail/${encodeURIComponent(slug)}`,
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user