Save hashed PW. Simplify model update. Bugfixes & improvements. Working user-settings & games.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"InfrantrySkillCalculator/models"
|
||||
"InfantrySkillCalculator/models"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
"net/http"
|
||||
@@ -25,6 +26,21 @@ func GetGames(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, games)
|
||||
}
|
||||
|
||||
// GetGamesHTML GET /game_html
|
||||
func GetGamesHTML(c *gin.Context) {
|
||||
var games []models.Game
|
||||
models.DB.Find(&games)
|
||||
|
||||
var htmlOptions string
|
||||
htmlOptions = `<option disabled selected value>Auswählen...</option>`
|
||||
for _, game := range games {
|
||||
htmlOptions += fmt.Sprintf(`<option value="%d">%s</option>`, game.ID, game.Name)
|
||||
}
|
||||
|
||||
c.Header("Content-Type", "text/html")
|
||||
c.String(http.StatusOK, htmlOptions)
|
||||
}
|
||||
|
||||
// GetGameByID GET /game/:id
|
||||
func GetGameByID(c *gin.Context) {
|
||||
var game models.Game
|
||||
|
||||
Reference in New Issue
Block a user