Skip to content

Commit

Permalink
fix: fix GitHub account bind related prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Nov 11, 2022
1 parent 5e28092 commit b69d5ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion controller/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ func GitHubBind(c *gin.Context) {
})
return
}
c.Redirect(http.StatusSeeOther, "/setting")
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "bind",
})
return
}
13 changes: 9 additions & 4 deletions web/src/components/GitHubOAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ const GitHubOAuth = () => {
const res = await API.get(`/api/oauth/github?code=${code}`);
const { success, message, data } = res.data;
if (success) {
userDispatch({ type: 'login', payload: data });
localStorage.setItem('user', JSON.stringify(data));
navigate('/');
showSuccess('登录成功!');
if (message === 'bind') {
showSuccess('绑定成功!');
navigate('/setting');
} else {
userDispatch({ type: 'login', payload: data });
localStorage.setItem('user', JSON.stringify(data));
showSuccess('登录成功!');
navigate('/');
}
} else {
showError(message);
if (count === 0) {
Expand Down

0 comments on commit b69d5ec

Please sign in to comment.