From 386bffe6baf8c12ccfb27bf2f8d130c36bd831d5 Mon Sep 17 00:00:00 2001 From: Nuung Date: Mon, 20 Nov 2023 11:32:49 +0900 Subject: [PATCH] hotfix: login again with new token --- backend/src/services/userInfoServices.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/src/services/userInfoServices.js b/backend/src/services/userInfoServices.js index 9d48392..38d08af 100644 --- a/backend/src/services/userInfoServices.js +++ b/backend/src/services/userInfoServices.js @@ -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