31 lines
506 B
JavaScript
31 lines
506 B
JavaScript
exports.getAnswer = (errors, data, success = true) => {
|
|
if (errors) {
|
|
return {
|
|
success: false,
|
|
errors,
|
|
}
|
|
}
|
|
|
|
return {
|
|
success,
|
|
body: data,
|
|
}
|
|
}
|
|
|
|
exports.getResponse = (errors, data, success = true) => {
|
|
if (errors.length) {
|
|
return {
|
|
success: false,
|
|
errors,
|
|
warnings: [],
|
|
}
|
|
}
|
|
|
|
return {
|
|
success,
|
|
body: data,
|
|
errors: [],
|
|
warnings: [],
|
|
}
|
|
}
|