mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
fix: handle non-array response when fetching Mihomo tags
This commit is contained in:
parent
392285058e
commit
7619b4d3e5
@ -324,9 +324,10 @@ const Mihomo: React.FC = () => {
|
|||||||
setLoadingTags(true)
|
setLoadingTags(true)
|
||||||
try {
|
try {
|
||||||
const data = await fetchMihomoTags(forceRefresh)
|
const data = await fetchMihomoTags(forceRefresh)
|
||||||
setTags(data)
|
setTags(Array.isArray(data) ? data : [])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch tags:', error)
|
console.error('Failed to fetch tags:', error)
|
||||||
|
setTags([])
|
||||||
alert(t('mihomo.error.fetchTagsFailed'))
|
alert(t('mihomo.error.fetchTagsFailed'))
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingTags(false)
|
setLoadingTags(false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user