introducing redux and fixing stuff
This commit is contained in:
@@ -26,16 +26,17 @@ func getCardById(c *gin.Context) {
|
||||
}
|
||||
|
||||
func createCard(c *gin.Context) {
|
||||
var card models.Card
|
||||
var card models.CardDto
|
||||
if err := c.BindJSON(&card); err != nil {
|
||||
return
|
||||
}
|
||||
card.UserID = c.GetUint("user_id")
|
||||
cardDbo := card.ToDbo()
|
||||
cardDbo.UserID = uint(c.GetFloat64("user_id"))
|
||||
|
||||
if models.DB.Create(&card).Save(&card).Error != nil {
|
||||
if models.DB.Create(&cardDbo).Save(&cardDbo).Error != nil {
|
||||
return
|
||||
}
|
||||
c.IndentedJSON(http.StatusCreated, card.ToDto())
|
||||
c.IndentedJSON(http.StatusCreated, cardDbo.ToDto())
|
||||
}
|
||||
|
||||
func updateCard(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user