Skip to content
This repository was archived by the owner on May 2, 2026. It is now read-only.

Commit 3a62d78

Browse files
committed
fix: 修复连接 URL 处理逻辑并确保 hubKey 为字符串类型
1 parent fb8878b commit 3a62d78

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/stores/hub.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ export const useHubStore = defineStore('hubStore', () => {
6464
: item
6565
: item.connect_url.endsWith('/')
6666
? {
67-
...item,
68-
connect_url: item.connect_url.slice(0, -1),
69-
}
67+
...item,
68+
connect_url: item.connect_url.slice(0, -1),
69+
}
7070
: item
7171
})
7272

@@ -88,11 +88,14 @@ export const useHubStore = defineStore('hubStore', () => {
8888
if (result.status === 'fulfilled' && result.value) {
8989
hubinfoList.value.push(result.value)
9090
const hubKey =
91-
typeof hubList.value[index] === 'string'
92-
? hubList.value[index]
93-
: hubList.value[index].connect_url
94-
// 将Hub信息存入Map
95-
hubInfoMap.value.set(hubKey, result.value)
91+
typeof hubList.value?.[index] === 'string'
92+
? hubList.value?.[index]
93+
: hubList.value?.[index]?.connect_url
94+
95+
// 将Hub信息存入Map(确保 hubKey 为 string)
96+
if (typeof hubKey === 'string') {
97+
hubInfoMap.value.set(hubKey, result.value)
98+
}
9699
} else {
97100
theToast.warning(`获取Hub信息失败: ${hubList.value[index]}`)
98101
}

0 commit comments

Comments
 (0)