Skip to content

Commit

Permalink
Meldung wenn keine Titel gefunden
Browse files Browse the repository at this point in the history
  • Loading branch information
kubegu committed Mar 5, 2024
1 parent 0c801ad commit a15d5ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package web

import (
"embed"
"fmt"
"log"
"net/http"
"strings"
Expand Down Expand Up @@ -31,7 +32,6 @@ func indexHandler(respWriter http.ResponseWriter, request *http.Request) {
}

func gameIndexHandler(respWriter http.ResponseWriter, request *http.Request) {
log.Print("received htmx game-index")
branch := strings.ToLower(request.PostFormValue("branch"))
platform := strings.ToLower(request.PostFormValue("platform"))
branchCode, exists := libClient.GetBranchCode(branch)
Expand All @@ -41,6 +41,12 @@ func gameIndexHandler(respWriter http.ResponseWriter, request *http.Request) {
}
client := libClient.Client{}
games := client.FindAvailabelGames(branchCode, platform)

if len(games) == 0 {
fmt.Fprint(respWriter, "<p>Es wurden keine ausleihbaren Titel gefunden.</p>")
return
}

data := map[string][]domain.Game{
"Games": games,
}
Expand Down

0 comments on commit a15d5ce

Please sign in to comment.