package route import ( "net/http" oidc "forge.cadoles.com/wpetit/goweb-oidc" "github.com/pkg/errors" "gitlab.com/wpetit/goweb/middleware/container" "gitlab.com/wpetit/goweb/service/template" ) func serveHomePage(w http.ResponseWriter, r *http.Request) { ctn := container.Must(r.Context()) tmpl := template.Must(ctn) idToken, _ := oidc.IDToken(w, r) if idToken != nil { http.Redirect(w, r, "/profile", http.StatusSeeOther) return } data := extendTemplateData(w, r, template.Data{}) if err := tmpl.RenderPage(w, "home.html.tmpl", data); err != nil { panic(errors.Wrapf(err, "could not render '%s' page", r.URL.Path)) } }