评论变为ajax加载 和提交

This commit is contained in:
2026-08-20 18:04:42 +08:00
parent d4d009f8b2
commit 6e88700f96
8 changed files with 345 additions and 217 deletions
+2 -4
View File
@@ -42,7 +42,8 @@ func setupFrontendRoutes(r *gin.Engine) {
r.GET("/page/:slug", middleware.OptionalAuth(), frontend.PageView)
r.GET("/search", middleware.OptionalAuth(), frontend.SearchView)
r.POST("/comment", frontend.SubmitComment)
r.GET("/posts/:postID/comments", frontend.ListComments)
r.POST("/posts/:postID/comment", frontend.SubmitComment)
r.GET("/logout", backend.WebLogout)
}
@@ -60,9 +61,6 @@ func setupPublicAPIRoutes(api *gin.RouterGroup) {
// 登录
api.POST("/auth/login", backend.Login)
// 创建评论(可选认证,登录后关联用户)
api.POST("/comments", middleware.OptionalAuth(), backend.CreateComment)
// 仪表盘公开统计数据(可选认证,登录后返回更多数据)
api.GET("/dashboard/stats", middleware.OptionalAuth(), backend.GetDashboardStats)