Skip to content

Commit

Permalink
feat: 로그인 생성 후 행사 생성 페이지로 리다이렉트
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachneee committed Nov 15, 2024
1 parent 14e4090 commit 18f04bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.net.URI;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
Expand Down Expand Up @@ -32,6 +33,9 @@ public class UserController {
private final AuthService authService;
private final CookieProperties cookieProperties;

@Value("${login-success.uri}")
private String loginSuccessUri;

@PatchMapping("/api/admin/users")
public ResponseEntity<Void> updateUser(
@Login Long userId,
Expand All @@ -58,8 +62,9 @@ public ResponseEntity<Void> kakaoLogin(@RequestParam String code) {
String jwtToken = authService.createGuestToken(userId);

ResponseCookie responseCookie = createResponseCookie(jwtToken);
return ResponseEntity.ok()
return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY)
.header(HttpHeaders.SET_COOKIE, responseCookie.toString())
.location(URI.create(loginSuccessUri))
.build();
}

Expand Down
3 changes: 3 additions & 0 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ kakao:
client-id: 52f24834ff7304ed2c47294b3f57b053
oauth-code-uri: https://kauth.kakao.com/oauth/authorize?client_id=%s&redirect_uri=%s&response_type=code&scope=openid

login-success:
uri: https://dev.haengdong.pro/event/create

---

spring:
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/resources/config

0 comments on commit 18f04bd

Please sign in to comment.