import { setWxInfo } from '@/service/index/api'

//uniapp 登陆获取用户信息
export const useLogin = () => {
  return new Promise(function (resolve, reject) {
    uni.login({
      success: function (res) {
        if (res.code) {
          resolve(res)
        } else {
          reject(res)
        }
      },
      fail: function (err) {
        reject(err)
      },
    })
  })
}

export const useWxInfo = ({ code, openId }) => {
  setWxInfo({ code, openId }).then((res) => {
    if (res.code === 200) {
      console.log(res.result)
    }
  })
}
