feat: add redirect on post after post creation

This commit is contained in:
Yanislav Igonin 2022-04-11 11:19:19 +03:00
parent d645af63da
commit 55cc4a3614
2 changed files with 5 additions and 4 deletions

View File

@ -212,7 +212,8 @@ func CreateThread(c *fiber.Ctx) error {
tx.Commit(context.TODO())
return c.Redirect("/"+strconv.Itoa(threadID), fiber.StatusFound)
path := "/" + strconv.Itoa(threadID)
return c.Redirect(path, fiber.StatusFound)
}
// Add new post in thread
@ -363,6 +364,6 @@ func UpdateThread(c *fiber.Ctx) error {
tx.Commit(context.TODO())
c.Append("Refresh", "0")
return c.SendStatus(fiber.StatusCreated)
path := "/" + strconv.Itoa(threadID) + "#" + strconv.Itoa(postID)
return c.Redirect(path)
}

View File

@ -1,5 +1,5 @@
{{ define "post" }}
<div class="post-container mb-4">
<div class="post-container mb-4" id="{{ .ID }}">
<div class="p-2">
<div class="post-info-container">
<span>{{ .CreatedAt.Format "Jan 02, 2006 15:04:05" }}</span>