Improved comm with client

This commit is contained in:
Florian Sylvain
2022-10-14 12:22:08 +02:00
parent 6328f9b8c1
commit 2096dbebc0
2 changed files with 19 additions and 15 deletions
+19
View File
@@ -0,0 +1,19 @@
package internal
import (
"net/http"
"github.com/gin-gonic/gin"
)
type answer struct {
Message string `json:"message"`
}
func SendErrorMessageToClient(c *gin.Context, message string) {
c.JSON(http.StatusBadRequest, answer{Message: message})
}
func SendOkMessageToClient(c *gin.Context, message string) {
c.JSON(http.StatusOK, answer{Message: message})
}
-15
View File
@@ -1,15 +0,0 @@
package internal
import (
"net/http"
"github.com/gin-gonic/gin"
)
type errorMessage struct {
Message string `json:"message"`
}
func SendErrorMessageToClient(c *gin.Context, message string) {
c.JSON(http.StatusBadRequest, errorMessage{Message: message})
}