首页异步问题修复,调试控制台增加token输出
This commit is contained in:
parent
1b36e63f5d
commit
a607ec008f
@ -270,15 +270,16 @@ export function parseHeader(head) {
|
||||
* 设置HTTP请求的默认头部信息
|
||||
* @param {Object} headerInfo 解析后的头部信息
|
||||
*/
|
||||
export function setHttpHeaders(headerInfo) {
|
||||
// 动态导入http.js中的函数来避免循环依赖
|
||||
import('../utils/http.js').then(httpModule => {
|
||||
export async function setHttpHeaders(headerInfo) {
|
||||
|
||||
try {
|
||||
const httpModule = await import('../utils/http.js')
|
||||
if (httpModule.setHeadersFromApp) {
|
||||
httpModule.setHeadersFromApp(headerInfo)
|
||||
}
|
||||
}).catch(error => {
|
||||
} catch(error) {
|
||||
console.error('Failed to update HTTP headers:', error)
|
||||
})
|
||||
}
|
||||
|
||||
console.debug('🔑 Authorization token set:', headerInfo.authorization)
|
||||
console.debug('🌍 Language set:', headerInfo.reqLang)
|
||||
|
||||
@ -118,7 +118,7 @@ export async function request(url, options = {}) {
|
||||
|
||||
try {
|
||||
if (DEBUG_MODE) {
|
||||
console.log('🚀 API Request:', fullUrl, config)
|
||||
console.log('🚀 API Request:', fullUrl, JSON.stringify(config.headers))
|
||||
}
|
||||
|
||||
const response = await fetch(fullUrl, config)
|
||||
|
||||
@ -176,7 +176,7 @@ const connectToApp = async () => {
|
||||
|
||||
// 设置HTTP请求头
|
||||
console.debug('🔧 Setting HTTP headers...')
|
||||
setHttpHeaders(headerInfo.value)
|
||||
await setHttpHeaders(headerInfo.value)
|
||||
|
||||
// 标记连接成功
|
||||
appConnected.value = true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user