import request from '@/utils/request'

// api地址
const api = {
  jssdkConfig: 'wxofficial/jssdkConfig',
  oauthUrl: 'wxofficial/oauthUrl',
  oauthUserInfo: 'wxofficial/oauthUserInfo'
}

// 获取微信公众号jssdk配置参数
const jssdkConfig = url => {
  return request.get(api.jssdkConfig, { url })
}

// 获取授权登录地址
const oauthUrl = callbackUrl => {
  return request.get(api.oauthUrl, { callbackUrl })
}

// 获取微信用户信息
const oauthUserInfo = code => {
  return request.get(api.oauthUserInfo, { code })
}

export default { jssdkConfig, oauthUrl, oauthUserInfo }
