mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-31 05:10:45 +08:00
优化动态标签页注册逻辑
This commit is contained in:
@@ -6,6 +6,9 @@ import {
|
||||
// @ts-ignore
|
||||
} from 'virtual:__federation__'
|
||||
|
||||
// 创建一个专用的AbortController,用于federationLoader请求
|
||||
const federationController = new AbortController()
|
||||
|
||||
// 定义远程模块接口
|
||||
interface RemoteModule {
|
||||
id: string
|
||||
@@ -62,7 +65,9 @@ export async function loadRemoteComponent(id: string, componentName: string = 'P
|
||||
*/
|
||||
async function fetchRemoteModules(): Promise<RemoteModule[]> {
|
||||
try {
|
||||
const response = await api.get('plugin/remotes?token=moviepilot')
|
||||
const response = await api.get('plugin/remotes?token=moviepilot', {
|
||||
signal: federationController.signal,
|
||||
})
|
||||
return (response as any) || []
|
||||
} catch (error) {
|
||||
console.error('获取远程模块列表失败:', error)
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user