Files
sonr/internal/gateway/handlers/render_index.go
T

22 lines
529 B
Go
Raw Normal View History

package handlers
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gateway/context"
"github.com/onsonr/sonr/internal/gateway/views"
"github.com/onsonr/sonr/pkg/common/response"
)
func RenderIndex(c echo.Context) error {
return response.TemplEcho(c, views.InitialView(isUnavailableDevice(c)))
}
// isUnavailableDevice returns true if the device is unavailable
func isUnavailableDevice(c echo.Context) bool {
s, err := context.Get(c)
if err != nil {
return true
}
return s.IsBot() || s.IsTV()
}