import { $getSiteInfos } from '@/api/manage'
import storage from 'store'
import { useOem } from '@/store/modules/oem'

/** http查询 & 放置到locationstore中 **/
export let setSiteInfos = () => {
    return $getSiteInfos().then((infoRes) => {

        let infos = infoRes.siteInfo

        infos.sysLogoUrl = infos.mgr.sysLogoUrl || infos.sysLogoUrl
        infos.sysMinLogoUrl = infos.mgr.sysMinLogoUrl || infos.sysMinLogoUrl
        infos.darkSysLogoUrl = infos.mgr.darkSysLogoUrl || infos.darkSysLogoUrl
        infos.darkSysMinLogoUrl = infos.mgr.darkSysMinLogoUrl || infos.darkSysMinLogoUrl

        // @ts-ignore: 放置到 localstore
        storage.set(window.$SITE_INFO_NAME, infoRes)

        // 放置到store中
        useOem().refInfo(infoRes)
        
    })
}


