Added frontend localization
This commit is contained in:
@@ -45,7 +45,7 @@ func NewServer(cfg config.Config) *Server {
|
||||
}
|
||||
swaggerHandler := ginSwagger.WrapHandler(swaggerFiles.Handler)
|
||||
|
||||
router.GET(openAPIEndpoint, func(c *gin.Context) {
|
||||
serveSwaggerIndex := func(c *gin.Context) {
|
||||
recorder := httptest.NewRecorder()
|
||||
proxyCtx, _ := gin.CreateTestContext(recorder)
|
||||
proxyCtx.Request = c.Request.Clone(c.Request.Context())
|
||||
@@ -69,8 +69,17 @@ func NewServer(cfg config.Config) *Server {
|
||||
|
||||
c.Status(recorder.Code)
|
||||
_, _ = c.Writer.WriteString(body)
|
||||
}
|
||||
|
||||
router.GET(openAPIEndpoint, serveSwaggerIndex)
|
||||
router.GET(openAPIEndpoint+"/*any", func(c *gin.Context) {
|
||||
if c.Param("any") == "/" {
|
||||
serveSwaggerIndex(c)
|
||||
return
|
||||
}
|
||||
|
||||
swaggerHandler(c)
|
||||
})
|
||||
router.GET(openAPIEndpoint+"/*any", swaggerHandler)
|
||||
}
|
||||
|
||||
apiV1 := router.Group("/api/v1")
|
||||
|
||||
Reference in New Issue
Block a user