Files
MoviePilot-Frontend/src/utils/globalSetting.ts

21 lines
596 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import api from '@/api'
// 创建一个专用的AbortController用于globalSetting请求
const globalSettingController = new AbortController()
export async function fetchGlobalSettings() {
try {
const result: { [key: string]: any } = await api.get('system/global', {
params: {
token: 'moviepilot',
},
// 手动设置signal防止reqestOptimizer添加可中断的controller
signal: globalSettingController.signal,
})
return result.data || {}
} catch (error) {
console.error('Failed to fetch global settings', error)
throw error
}
}