Skip to content

Commit

Permalink
hotfix: login again with new token
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuung committed Nov 20, 2023
1 parent 92d58ce commit 386bffe
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions backend/src/services/userInfoServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@ export const signUpORsignIn = async (req, res) => {
const userChkTwo = await UserInfo.findByuserId(userCheckData.data.data.currentUser.username);

if (userChkTwo) {
/*
// user token update
const updateResult = await UserInfo.updateTokenByuserId(userChkTwo.userId, accessToken, refreshToken);
if (updateResult.matchedCount && updateResult.modifiedCount) {
await setAuthCookie(res, accessToken, refreshToken);
return res.status(200).json({
message: "User logined and updated successfully",
user: userChkTwo
});
}

if (updateResult.matchedCount && updateResult.modifiedCount) { }
return res.status(400).json({
message: "User updated fail",
user: userChkTwo
});
*/

await setAuthCookie(res, userChkTwo.accessToken, userChkTwo.refreshToken);
return res.status(200).json({
message: "User logined and updated successfully",
user: userChkTwo
});
}

// 그래도 존재하지 않으면 신규 가입 -> 만료된 토큰일 가능성 있음, 그때 error
Expand Down

0 comments on commit 386bffe

Please sign in to comment.