diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2022-05-21 11:20:45 -0600 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2022-05-21 11:20:45 -0600 |
commit | e269b111a18c8822b0c16f1567548bc598b25997 (patch) | |
tree | f025a7e34e9905e4f51263c70c27e8a66d644677 /srv/src/http/posts.go | |
parent | 3059909deb5e21746d3d95e4989a78db51ccec33 (diff) |
List existing tags on edit post page
Diffstat (limited to 'srv/src/http/posts.go')
-rw-r--r-- | srv/src/http/posts.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/srv/src/http/posts.go b/srv/src/http/posts.go index daa756c..c05f3de 100644 --- a/srv/src/http/posts.go +++ b/srv/src/http/posts.go @@ -205,7 +205,21 @@ func (a *api) renderEditPostHandler() http.Handler { } } - executeTemplate(rw, r, tpl, storedPost) + tags, err := a.params.PostStore.GetTags() + if err != nil { + apiutil.InternalServerError(rw, r, fmt.Errorf("fetching tags: %w", err)) + return + } + + tplPayload := struct { + Post post.StoredPost + Tags []string + }{ + Post: storedPost, + Tags: tags, + } + + executeTemplate(rw, r, tpl, tplPayload) }) } |