pollo/pages/dashboard.go

29 lines
524 B
Go
Raw Normal View History

2024-06-27 21:23:51 -06:00
package pages
import (
"pollo/lib"
"github.com/labstack/echo/v4"
)
type DashboardProps struct {
2024-07-09 11:10:32 -06:00
Name string
2024-06-27 21:23:51 -06:00
}
func Dashboard(c echo.Context) error {
2024-06-28 00:35:58 -06:00
currentSession, error := lib.GetSessionCookie(c.Request(), "session")
if error != nil {
2024-07-09 11:10:32 -06:00
lib.LogError.Printf("Error getting session: %v", error)
2024-06-28 00:35:58 -06:00
}
2024-06-27 21:51:00 -06:00
props := DashboardProps{
2024-07-09 11:10:32 -06:00
Name: currentSession.Name,
2024-06-27 21:51:00 -06:00
}
2024-06-27 21:23:51 -06:00
// Specify the partials used by this page
partials := []string{"header"}
// Render the template
2024-07-09 11:10:32 -06:00
return lib.RenderTemplate(c, "base", partials, props)
2024-06-27 21:23:51 -06:00
}