20 lines
355 B
Go
20 lines
355 B
Go
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/gofiber/fiber/v2"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
type IndexHandler struct {
|
||
|
}
|
||
|
|
||
|
func (h IndexHandler) Index(c *fiber.Ctx) error {
|
||
|
prefs := GetPrefCookie(c)
|
||
|
if prefs.SiteID > 0 {
|
||
|
return c.Redirect(fmt.Sprintf("/sites/%v/posts", prefs.SiteID), http.StatusFound)
|
||
|
}
|
||
|
|
||
|
return c.Render("index", fiber.Map{}, "layouts/main")
|
||
|
}
|