mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
Improved comm with client
This commit is contained in:
@@ -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})
|
||||||
|
}
|
||||||
@@ -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})
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user