修复程序初始化顺序导致的问题
parent
2aa4ff8422
commit
2d5e336f0f
|
@ -5,13 +5,13 @@ import musicSdk from '@renderer/utils/musicSdk'
|
|||
import apiSourceInfo from '@renderer/utils/musicSdk/api-source-info'
|
||||
|
||||
|
||||
export const setUserApi = (apiId: string) => {
|
||||
export const setUserApi = async(apiId: string) => {
|
||||
if (/^user_api/.test(apiId)) {
|
||||
qualityList.value = {}
|
||||
userApi.status = false
|
||||
userApi.message = 'initing'
|
||||
|
||||
setUserApiAction(apiId).then(() => {
|
||||
await setUserApiAction(apiId).then(() => {
|
||||
apiSource.value = apiId
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
|
|
|
@ -14,7 +14,7 @@ const initPrevPlayInfo = async() => {
|
|||
window.lx.restorePlayInfo = null
|
||||
if (!info?.listId || info.index < 0) return
|
||||
const list = await getListMusics(info.listId)
|
||||
if (!list || !list[info.index]) return
|
||||
if (!list?.[info.index]) return
|
||||
window.lx.restorePlayInfo = info
|
||||
playList(info.listId, info.index)
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ export default () => {
|
|||
})
|
||||
|
||||
return async() => {
|
||||
void setUserApi(appSetting['common.apiSource'])
|
||||
return await getUserApiList().then(list => {
|
||||
await setUserApi(appSetting['common.apiSource'])
|
||||
void getUserApiList().then(list => {
|
||||
// console.log(list)
|
||||
// if (![...apiSourceInfo.map(s => s.id), ...list.map(s => s.id)].includes(appSetting['common.apiSource'])) {
|
||||
// console.warn('reset api')
|
||||
|
|
|
@ -23,7 +23,7 @@ export default () => {
|
|||
})
|
||||
|
||||
watch(() => appSetting['common.apiSource'], apiSource => {
|
||||
setUserApi(apiSource)
|
||||
void setUserApi(apiSource)
|
||||
})
|
||||
|
||||
watch(() => appSetting['common.font'], (val) => {
|
||||
|
|
Loading…
Reference in New Issue