user.js 686 Bytes
import {
  SET_OPENID
} from '../constants/user'

export const setOpenId = function(openID) {
  return {
    type: SET_OPENID,
    openID
  }
}
export const wechatIsBind = function() {
  return dispatch => {
    return new Promise((resolve, reject) => {
      wx.login({
        success: (res) => {
          dispatch(setOpenId('openId'))
          return resolve({name: 'openId'});
        }
      });
    })
  }
}
export const wechatLogin = function() {
  return dispatch => {
    return new Promise((resolve, reject) => {
      wx.login({
        success: (res) => {
          dispatch(setOpenId('openId'))
          return resolve({name: 'openId'});
        }
      });
    })
  }
}