// import WindVane from '@ali/lib-windvane' import WindVane from '../../../../lib/windvane.common.js' import mtop from './mtop' import { qsParse } from '../../security' export default function (option) { if ( // /*process.env.NODE_ENV !== 'development' */true && !WindVane.isAvailable ) { option.data['authInfo'] = localStorage['__authInfo'] || {} } const mtopEnv = qsParse().mtopEnv || '' const lib = window['lib'] if (lib && /^pre/.test(mtopEnv)) { lib.mtop.config.subDomain = 'wapa' lib.mtop.config.mainDomain = 'taobao.com' lib.mtop.config.prefix = 'h5api' } return mtop(option).then(d => { const data = d || {} if (data.success + '' !== 'true') { const msg = `${data.msgCode}::${data.msgInfo}` return Promise.reject(msg) } const model = data.model || [] return model }).catch(e => { console.error(e) // toast(e) return Promise.reject(e) }) }