import {getOpenId, getUserData} from '../api/login.js'
export function getOpenidData() {
    return new Promise((resolve)=> {
        wx.login({
            success: result=> {
                let code = result.code
                getOpenId(code).then(i=> {
                    if(i.code === 0) {
                        const openid = i.data
                        wx.setStorage({
                            key: 'openid',
                            data: openid
                        })
                        resolve({openid})
                    }
                })
            }
        })
    }) 
}
