mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 06:12:33 +03:00
feat: add redirect on post after post creation
This commit is contained in:
parent
d645af63da
commit
55cc4a3614
@ -212,7 +212,8 @@ func CreateThread(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
tx.Commit(context.TODO())
|
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
|
// Add new post in thread
|
||||||
@ -363,6 +364,6 @@ func UpdateThread(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
tx.Commit(context.TODO())
|
tx.Commit(context.TODO())
|
||||||
|
|
||||||
c.Append("Refresh", "0")
|
path := "/" + strconv.Itoa(threadID) + "#" + strconv.Itoa(postID)
|
||||||
return c.SendStatus(fiber.StatusCreated)
|
return c.Redirect(path)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "post" }}
|
{{ define "post" }}
|
||||||
<div class="post-container mb-4">
|
<div class="post-container mb-4" id="{{ .ID }}">
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<div class="post-info-container">
|
<div class="post-info-container">
|
||||||
<span>{{ .CreatedAt.Format "Jan 02, 2006 15:04:05" }}</span>
|
<span>{{ .CreatedAt.Format "Jan 02, 2006 15:04:05" }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user