Skip to content

Commit

Permalink
Fix: pw 기반 유저 FCM Token 등록 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
pingowl authored Nov 19, 2024
1 parent 14ac15b commit a4253ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/com/drugbox/controller/AuthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ public ResponseEntity<IdResponse> signup(@RequestBody UserLoginRequest userLogin
}

@PostMapping("/login/pw")
public ResponseEntity<TokenDto> login(@RequestBody UserLoginRequest userLoginRequest) {
return ResponseEntity.ok(authService.login(userLoginRequest));
public ResponseEntity<TokenDto> login(@RequestBody UserLoginRequest request) {
checkFCMToken(request.getFcmToken());
TokenDto response = authService.login(request);
fcmTokenService.saveToken(response.getUserId(), request.getFcmToken());
return ResponseEntity.ok(response);
}

// AccessToken 재발급
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class UserLoginRequest {

private String email;
private String password;
private String fcmToken;

public User toUser(PasswordEncoder passwordEncoder) {
return User.builder()
Expand Down

0 comments on commit a4253ac

Please sign in to comment.