Skip to content

Commit

Permalink
support withCredentials and lang
Browse files Browse the repository at this point in the history
  • Loading branch information
jas0ncn authored Mar 3, 2018
1 parent 7930217 commit d7dd282
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ var LoginError = (function () {
/**
* 微信登录,获取 code 和 encryptData
*/
var getWxLoginResult = function getLoginCode(callback) {
var getWxLoginResult = function getLoginCode(callback, withCredentials, lang) {
wx.login({
success: function (loginResult) {
wx.getUserInfo({
withCredentials: withCredentials,
lang: lang,
success: function (userResult) {
callback(null, {
code: loginResult.code,
Expand Down Expand Up @@ -57,6 +59,8 @@ var defaultOptions = {
success: noop,
fail: noop,
loginUrl: null,
withCredentials: true,
lang: 'zh_CN',
};

/**
Expand Down Expand Up @@ -130,7 +134,7 @@ var login = function login(options) {
options.fail(error);
},
});
});
}, options.withCredentials, options.lang);

doLogin();
};
Expand Down

0 comments on commit d7dd282

Please sign in to comment.