2024-10-16 11:06:23 +03:00
|
|
|
exports.getAnswer = (errors, data, success = true) => {
|
2023-08-01 13:14:02 +03:00
|
|
|
if (errors) {
|
|
|
|
return {
|
|
|
|
success: false,
|
|
|
|
errors,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
success,
|
|
|
|
body: data,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-16 11:06:23 +03:00
|
|
|
exports.getResponse = (errors, data, success = true) => {
|
2023-08-01 13:14:02 +03:00
|
|
|
if (errors.length) {
|
|
|
|
return {
|
|
|
|
success: false,
|
|
|
|
errors,
|
|
|
|
warnings: [],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
success,
|
|
|
|
body: data,
|
|
|
|
errors: [],
|
|
|
|
warnings: [],
|
|
|
|
}
|
|
|
|
}
|