export function wxLogin(): Promise<WechatMiniprogram.LoginSuccessCallbackResult> {
    return new Promise((resolve, reject) => {
      wx.login({
        success: resolve,
        fail: reject
      })
    })
  }
  
  export function wxRequest<T>(options: WechatMiniprogram.RequestOption): Promise<T> {
    return new Promise((resolve, reject) => {
      wx.request({
        ...options,
        success: (res) => resolve(res as any),
        fail: reject
      })
    })
  }

  export function wxGetUserInfo(): Promise<WechatMiniprogram.GetUserInfoSuccessCallbackResult> {
    return new Promise((resolve, reject) => {
      wx.getUserInfo({
        success: resolve,
        fail: reject
      })
    })
  }

  export function wxRequestSubscribe(tmplIds:any) {
    return new Promise((resolve, reject) => {
      wx.requestSubscribeMessage({
        tmplIds,
        success(res) {
          resolve(res);
        },
        fail(err) {
          reject(err);
        }
      });
    });
  }