Skip to content

Commit

Permalink
fixed the /related issues
Browse files Browse the repository at this point in the history
also added a better /cartegorybfor the json correspondance
  • Loading branch information
SuperninjaXII committed Nov 18, 2024
1 parent 297b785 commit bbdfba2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions controllers/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func GetBookByCartegoryBooks(c *fiber.Ctx) error {
if result.RowsAffected == 0 {
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "No books found in this category"})
}
return c.Render("components/searchResults", fiber.Map{
"Result": result,
return c.Render("components/related", fiber.Map{
"Result": books,
})
}
11 changes: 11 additions & 0 deletions views/components/related.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Result }}
<!--some comment-->
{{range .Result}}
<div>
<p>{{.Title}}</p>
</div>
{{end}}
<!--some comment-->
{{else}}
<p>no related</p>
{{end}}
6 changes: 4 additions & 2 deletions views/components/searchResults.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{{range .Result}}
<li>
<a href="/Download/{{.Model.ID}}" hx-trigger="click" hx-target="main"
>{{.Title}}</a>
>{{.Title}}</a
>
</li>
{{end}}

{{end}}>

0 comments on commit bbdfba2

Please sign in to comment.