17 lines
337 B
Plaintext
17 lines
337 B
Plaintext
import json_params, capture_errors from require "lapis.application"
|
|
import remove from table
|
|
|
|
api_request = (fn) ->
|
|
json_params capture_errors {
|
|
fn,
|
|
on_error: =>
|
|
status = 400
|
|
if "number" == type @errors[1]
|
|
status = remove(@errors, 1)
|
|
return(:status, json: { errors: @errors })
|
|
}
|
|
|
|
{
|
|
:api_request
|
|
}
|