Feature: link to your bookmarks

This commit is contained in:
VnPower 2023-07-27 10:08:34 +07:00
parent a313193000
commit 03a199e111
Signed by: vnpower
GPG key ID: 881DE3DEB966106C
3 changed files with 16 additions and 0 deletions

View file

@ -37,6 +37,8 @@
<br />
<a class="sidebar-item" href="/self/following_works">
<img src="/assets/users.png" alt="icon" />Latest by followed</a>
<a class="sidebar-item" href="/self/bookmarks">
<img src="/assets/heart.png" alt="icon" />Your bookmarks</a>
<a class="sidebar-item" href="/self">
<img src="/assets/user.png" alt="icon" />Your profile</a>
<br />

View file

@ -265,6 +265,19 @@ func following_works_page(c *fiber.Ctx) error {
return c.Render("pages/following", fiber.Map{"Title": "Following works", "Queries": queries, "Artworks": artworks, "Page": pageInt})
}
func your_bookmark_page(c *fiber.Ctx) error {
token := get_session_value(c, "token")
if token == nil {
return c.Redirect("/login")
}
// The left part of the token is the member ID
userId := strings.Split(*token, "_")
c.Redirect("/users/" + userId[0] + "/bookmarks#checkpoint")
return nil
}
func login_page(c *fiber.Ctx) error {
return c.Render("pages/login", fiber.Map{})
}

View file

@ -52,6 +52,7 @@ func SetupRoutes(r *fiber.App) {
self := r.Group("self")
self.Get("/", get_logged_in_user)
self.Get("/following_works", following_works_page)
self.Get("/bookmarks", your_bookmark_page)
r.Get("login", login_page)
r.Post("tags", search)