2025-01-31 23:56:59 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2025-02-03 10:35:58 +00:00
|
|
|
"github.com/gofiber/fiber/v3"
|
2025-01-31 23:56:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type IndexHandler struct {
|
|
|
|
}
|
|
|
|
|
2025-02-03 10:35:58 +00:00
|
|
|
func (h IndexHandler) Index(c fiber.Ctx) error {
|
2025-01-31 23:56:59 +00:00
|
|
|
prefs := GetPrefCookie(c)
|
|
|
|
if prefs.SiteID > 0 {
|
2025-02-03 10:35:58 +00:00
|
|
|
return c.Redirect().To(fmt.Sprintf("/sites/%v/posts", prefs.SiteID))
|
2025-01-31 23:56:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return c.Render("index", fiber.Map{}, "layouts/main")
|
|
|
|
}
|