kra-new/internal/server/response.go

30 lines
690 B
Go

package server
import (
"kra/internal/server/httpx"
"github.com/gin-gonic/gin"
)
const (
codeSuccess = httpx.CodeSuccess
codeError = httpx.CodeError
codePasswordChangeRequired = httpx.CodePasswordChangeRequired
)
type response = httpx.Response
type pageResult = httpx.PageResult
func writeResult(c *gin.Context, code int, data any, message string) {
httpx.Write(c, code, data, message)
}
func ok(c *gin.Context) { httpx.OK(c) }
func okWithData(c *gin.Context, data any) { httpx.OKWithData(c, data) }
func fail(c *gin.Context, message string) { httpx.Fail(c, message) }
func noAuth(c *gin.Context, message string) { httpx.NoAuth(c, message) }