gopay/internal/context/response.go

20 lines
339 B
Go
Raw Permalink Normal View History

package context
import v1 "git.supernets.org/perp/gopay/internal/models/v1"
// Return a JSON error
func (ctx *Context) Error(code int, err string) {
error := v1.Error{
Type: err,
}
ctx.JSON(code, error)
}
// Return a JSON token
func (ctx *Context) Token(toke string) {
token := v1.Token{
Token: toke,
}
ctx.JSON(200, token)
}