getting closer
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-09 11:49:59 +11:00
parent bc1021cd12
commit a4a25164d0
2 changed files with 12 additions and 12 deletions

View File

@@ -191,7 +191,7 @@ func CheckUpdateSecretAllowed(s *models.Secret, user_id int) (int, error) {
func UpdateSecret(c *gin.Context) {
var err error
var input StoreInput
//var user_id int
var user_id int
if err := c.ShouldBindJSON(&input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "UpdateSecret error binding to input JSON : " + err.Error()})
@@ -218,15 +218,15 @@ func UpdateSecret(c *gin.Context) {
}
*/
log.Printf("c.Keys: %v\n", c.Keys)
user_id := c.GetInt("user-id")
/*
if val, ok := c.Get("user-id"); !ok {
c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"})
return
} else {
user_id = val.(int)
}
*/
//user_id := c.GetInt("user-id")
if val, ok := c.Get("user-id"); !ok {
c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"})
return
} else {
user_id = val.(int)
}
log.Printf("user_id: %v\n", user_id)
// Populate fields