Skip to content

Commit

Permalink
feat(ui): redirect to edited form on account page
Browse files Browse the repository at this point in the history
  • Loading branch information
vednoc committed Aug 16, 2021
1 parent 72436f6 commit 9b0027e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions handlers/user/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ func EditAccount(c *fiber.Ctx) error {

var record = map[string]interface{}{"id": user.ID}

switch c.Params("form") {
form := c.Params("form")
switch form {
case "name":
name := strings.TrimSpace(c.FormValue("name"))
prev := user.DisplayName
Expand Down Expand Up @@ -136,5 +137,5 @@ func EditAccount(c *fiber.Ctx) error {
})
}

return c.Status(fiber.StatusSeeOther).Redirect("/account")
return c.Status(fiber.StatusSeeOther).Redirect("/account#" + form)
}
2 changes: 1 addition & 1 deletion views/user/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h2 class="sub-title td:d mt:l">Display name</h2>
</form>
</section>

<section id="about">
<section id="bio">
<h2 class="sub-title td:d mt:l">About</h2>
<div class="md">{{- .Params.Biography | MarkdownUnsafe -}}</div>
<form class="Form Form-box mt:m" method="post" action="/account/bio">
Expand Down

0 comments on commit 9b0027e

Please sign in to comment.