mirror of
https://github.com/ordinary-dev/phoenix
synced 2024-09-20 03:40:29 +05:00
26 lines
431 B
Go
26 lines
431 B
Go
|
package views
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"github.com/ordinary-dev/phoenix/backend"
|
||
|
"gorm.io/gorm"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func ShowMainPage(c *gin.Context, db *gorm.DB) {
|
||
|
if err := RequireAuth(c, db); err != nil {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// Get a list of groups with links
|
||
|
groups, err := backend.GetGroups(db)
|
||
|
if err != nil {
|
||
|
ShowError(c, err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
c.HTML(http.StatusOK, "index.html.tmpl", gin.H{
|
||
|
"groups": groups,
|
||
|
})
|
||
|
}
|