18 lines
351 B
Go
18 lines
351 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"qr-scanner/models"
|
|
)
|
|
|
|
func respondOK[T any](c *gin.Context, data T) {
|
|
c.JSON(http.StatusOK, models.APIResponse[T]{Code: 200, Message: "OK", Data: data})
|
|
}
|
|
|
|
func fail(c *gin.Context, status int, msg string) {
|
|
c.JSON(status, models.APIResponse[any]{Code: status, Message: msg})
|
|
}
|