Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
修改extend传参
  • Loading branch information
khzhg committed Sep 30, 2025
commit d2513fd5f53a63b58b239fd13d363b379102bb52
16 changes: 15 additions & 1 deletion dashboard/src/api/modules/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,22 @@ const buildModuleUrl = (module) => {
*/
const directApiCall = async (apiUrl, params = {}) => {
try {
// 为了确保像 `extend` 这样的对象被作为单个 JSON 字符串传递(而不是被 axios 序列化为 extend[host]=...&extend[version]=...),
const serializedParams = { ...params }
Object.keys(serializedParams).forEach((key) => {
const val = serializedParams[key]
if (val !== null && typeof val === 'object') {
try {
serializedParams[key] = JSON.stringify(val)
} catch (err) {
// 如果序列化失败,保留原值并打印警告
console.warn(`无法序列化参数 ${key}`, err)
}
}
})

const response = await axios.get(apiUrl, {
params,
params: serializedParams,
timeout: 30000,
headers: {
'Accept': 'application/json'
Expand Down