package routewde import ( "net/http" "personalwebsite/wde" "github.com/gin-gonic/gin" ) func Route(route *gin.RouterGroup, wde *wde.WDE) { route.GET("/getbasicwindow", func(ctx *gin.Context) { ctx.HTML(http.StatusOK, "basic-window.html", nil) }) route.GET("/renderMobileDesktop", func(ctx *gin.Context) { ctx.HTML(http.StatusOK, "base/mobile-desktop.tmpl", nil) }) widgets := route.Group("widgets") { widgets.GET("/file-tile-view", func(ctx *gin.Context) { path := ctx.Query("path") if path == "" { ctx.JSON(http.StatusBadRequest, "TODO") //TODO json error struct return } ginH, err := wde.RenderFileTileView(path) if err != nil { ctx.JSON(http.StatusInternalServerError, "TODO") //TODO return } ctx.HTML(http.StatusOK, "wde-widgets/file-tile-view.tmpl", ginH) }) } }