Websites/app/logical/yiffyapi_util.rb
2024-05-02 22:04:43 -05:00

16 lines
286 B
Ruby

# 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