added exception messages to controllers

This commit is contained in:
Fran Jurmanović
2022-02-20 10:38:08 +01:00
parent 1b418ec5a2
commit 341647ccd9
18 changed files with 516 additions and 182 deletions

View File

@@ -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