mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
added exception messages to controllers
This commit is contained in:
@@ -51,6 +51,7 @@ func (rc *AuthController) PostLogin(c *gin.Context) {
|
||||
|
||||
if exceptionReturn.Message != "" {
|
||||
c.JSON(exceptionReturn.StatusCode, exceptionReturn)
|
||||
return
|
||||
} else {
|
||||
c.JSON(200, returnedUser)
|
||||
}
|
||||
@@ -74,6 +75,7 @@ func (rc *AuthController) PostRegister(c *gin.Context) {
|
||||
|
||||
if exceptionReturn.Message != "" {
|
||||
c.JSON(exceptionReturn.StatusCode, exceptionReturn)
|
||||
return
|
||||
} else {
|
||||
c.JSON(200, returnedUser.Payload())
|
||||
}
|
||||
@@ -94,6 +96,7 @@ func (rc *AuthController) Delete(c *gin.Context) {
|
||||
|
||||
if er.Message != "" {
|
||||
c.JSON(er.StatusCode, er)
|
||||
return
|
||||
} else {
|
||||
c.JSON(200, mr)
|
||||
}
|
||||
@@ -114,6 +117,7 @@ func (rc *AuthController) CheckToken(c *gin.Context) {
|
||||
if err != nil {
|
||||
re.Valid = false
|
||||
c.AbortWithStatusJSON(400, re)
|
||||
return
|
||||
}
|
||||
|
||||
re.Valid = true
|
||||
|
||||
Reference in New Issue
Block a user