Skip to content

Commit

Permalink
Send Server on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
inciner8r committed Jan 22, 2024
1 parent 816f460 commit afe381d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/v1/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/NetSepio/erebrus/core"
"github.com/NetSepio/erebrus/model"
"github.com/NetSepio/erebrus/util"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"github.com/skip2/go-qrcode"
Expand Down Expand Up @@ -56,8 +57,14 @@ func registerClient(c *gin.Context) {
c.JSON(http.StatusInternalServerError, response)
return
}

response := core.MakeSucessResponse(201, "client created", nil, client, nil)
server, err := core.ReadServer()
if err != nil {
log.WithFields(util.StandardFields).Error("Failure in reading server")
response := core.MakeErrorResponse(500, err.Error(), nil, nil, nil)
c.JSON(http.StatusInternalServerError, response)
return
}
response := core.MakeSucessResponse(201, "client created", server, client, nil)

c.JSON(http.StatusOK, response)
}
Expand Down

0 comments on commit afe381d

Please sign in to comment.