feat(升级中心): 实现备用更新方案并优化版本检查逻辑
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { IRequestOptions } from '../types'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { APP_INFO } from '@/api/config'
|
||||
import { getCurrentVersion } from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version'
|
||||
|
||||
export function requestInterceptor(options: IRequestOptions): IRequestOptions {
|
||||
const headers = { ...(options.headers || {}) }
|
||||
@@ -21,9 +22,12 @@ export function requestInterceptor(options: IRequestOptions): IRequestOptions {
|
||||
headers['Content-Type'] = 'application/json;charset=UTF-8'
|
||||
}
|
||||
|
||||
getCurrentVersion().then((version_code: string) => {
|
||||
headers['version_code'] = version_code || ''
|
||||
})
|
||||
|
||||
headers['appType'] = APP_INFO.TYPE
|
||||
headers['version_code'] = APP_INFO.VERSION_CODE || '1.0.0'
|
||||
|
||||
|
||||
return {
|
||||
...options,
|
||||
header: headers,
|
||||
|
||||
Reference in New Issue
Block a user