Register f.ArticlePreviewHtmlData in init()

This commit is contained in:
Jason Streifling 2024-07-13 14:17:40 +02:00
parent b2db128aa9
commit 084b101e31
2 changed files with 8 additions and 7 deletions

View File

@ -16,6 +16,12 @@ import (
b "streifling.com/jason/cpolis/cmd/backend"
)
type ArticlePreviewHtmlData struct {
Title string
Description string
Content template.HTML
}
func ShowHub(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
session, err := s.Get(r, "cookie")
@ -442,14 +448,8 @@ func UploadImage(c *b.Config) http.HandlerFunc {
func PreviewArticle(c *b.Config, s *b.CookieStore) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
type htmlData struct {
Title string
Description string
Content template.HTML
}
var err error
data := new(htmlData)
data := new(ArticlePreviewHtmlData)
data.Title, err = b.ConvertToPlain(r.PostFormValue("article-title"))
if err != nil {

View File

@ -12,6 +12,7 @@ import (
func init() {
gob.Register(b.User{})
gob.Register(f.ArticlePreviewHtmlData{})
}
func main() {