27 lines
489 B
Go
27 lines
489 B
Go
package app
|
|
|
|
import (
|
|
"github.com/labstack/echo/v4"
|
|
"gitnet.fr/deblan/budget/database/model"
|
|
"gitnet.fr/deblan/budget/backend/view"
|
|
"gitnet.fr/deblan/budget/backend/view/template/app"
|
|
)
|
|
|
|
type Controller struct {
|
|
}
|
|
|
|
func New(e *echo.Echo) *Controller {
|
|
c := Controller{}
|
|
|
|
e.GET("/", c.HomeGet)
|
|
|
|
return &c
|
|
}
|
|
|
|
func (ctrl *Controller) HomeGet(c echo.Context) error {
|
|
if nil == model.LoadSessionUser(c) {
|
|
return c.Redirect(302, "/login")
|
|
}
|
|
|
|
return view.Render(c, 200, app.Page())
|
|
}
|