Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix(signin): 修复微信登陆不能的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Oct 30, 2018
1 parent 7839d6a commit 3c5f696
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/page/wechat/WechatSignin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ export default {
this.$http
.post(
"socialite/wechat",
{
access_token: accessToken
},
{
validateStatus: s => s === 201
}
{ access_token: accessToken },
{ validateStatus: s => s === 201 || s === 404 }
)
.then(({ data: { token = "", user = {} } = {} }) => {
.then(({ status, data: { token = "", user = {} } = {} }) => {
if (status !== 201) {
this.loading = false;
this.getWechatUserInfo(accessToken, openId);
return;
}
// 保存用户信息 并跳转
this.$router.push(this.$route.query.redirect || "/feeds?type=hot");
this.$nextTick(() => {
Expand All @@ -125,10 +126,6 @@ export default {
this.$lstore.setData("H5_ACCESS_TOKEN", `Bearer ${token}`);
this.$store.commit("SAVE_CURRENTUSER", user);
});
})
.catch(() => {
this.loading = false;
this.getWechatUserInfo(accessToken, openId);
});
},
Expand Down

0 comments on commit 3c5f696

Please sign in to comment.