Skip to content

Commit

Permalink
[FIX] 로그인 시 fcm 토큰 업데이트 하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yeseul106 committed May 7, 2024
1 parent 2db7ae3 commit 0ad55ab
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/service/authService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const signIn = async (
await prisma.user.update({
data: {
refresh_token: refreshToken,
fcm_token: fcmToken,
},
where: {
id: userId,
Expand All @@ -93,25 +94,14 @@ const signIn = async (
};
}

//* fcm 토큰 비어있으면 저장
if (!userInSocial.fcm_token) {
await prisma.user.update({
data: {
fcm_token: fcmToken,
},
where: {
id: userInSocial.id,
},
});
}

//* 기존에 회원이 등록되어있으면, 자동 로그인
const accessToken = jwtHandler.sign(userInSocial.id);
const refreshToken = jwtHandler.getRefreshToken();

await prisma.user.update({
data: {
refresh_token: refreshToken,
fcm_token: fcmToken,
},
where: {
id: userInSocial.id,
Expand Down

0 comments on commit 0ad55ab

Please sign in to comment.