fix: encode URI components in API calls and links to ensure proper formatting

This commit is contained in:
Ardeman
2025-03-10 14:49:09 +08:00
parent 169f0166b8
commit 54a8a97c09
3 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -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