Skip to content

Commit

Permalink
인증 경로 및 핸들러를 리팩터링
Browse files Browse the repository at this point in the history
  • Loading branch information
in-jun committed May 9, 2024
1 parent 3d07700 commit 453acd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@

authButton.addEventListener("click", function () {
const currentPath = window.location.pathname;
window.location.href = "/api/login?current=" + encodeURIComponent(currentPath);
window.location.href = "/api/auth/login?current=" + encodeURIComponent(currentPath);
});

logoutButton.addEventListener("click", function () {
fetch("/api/logout", {
fetch("/api/auth/logout", {
method: 'GET'
})
.then(response => response.json())
Expand Down
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ func main() {
user.GET("/:username/svg", getUserCommentSVG)
}

api.GET("/login", handleLogin)
api.GET("/auth/callback", handleCallback)
api.GET("/logout", handleLogout)
auth := api.Group("/auth")
{
auth.GET("/login", handleLogin)
auth.GET("/callback", handleCallback)
auth.GET("/logout", handleLogout)
}
}
// Favicon routing
router.StaticFile("/favicon.ico", "./favicon.ico")
Expand Down

0 comments on commit 453acd9

Please sign in to comment.