Websites/app/logical/yiffyapi_util.rb

16 lines
286 B
Ruby
Raw Normal View History

2024-05-03 03:04:43 +00:00
# frozen_string_literal: true
module YiffyAPIUtil
def build_failure_response(code, **data)
{
success: false,
code: code.code,
**data,
}
end
def render_error(code, **)
render(json: build_failure_response(code, **), status: code.status)
end
end