import request from './request'
import storage from './storage'


export function wxgetCode(params) {
    return new Promise((resolve, reject) => {
		// let spread_id = parseInt(storage.get('spread_id'));
		// if(spread_id > 0){
		// 	params.spread_id = spread_id;
		// }
        request.post("/user/session",params).then(result=>{
            resolve(result)
        }).catch(err=>{
            reject(err)
        });
    })
}

export function wxLogin(params) {
    return new Promise((resolve, reject) => {
		// let spread_id = parseInt(storage.get('spread_id'));
		// if(spread_id > 0){
		// 	params.spread_id = spread_id;
		// }
        request.post("/user/login",params).then(result=>{
            resolve(result)
        }).catch(err=>{
            reject(err)
        });
    })
}