mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 08:34:48 +00:00
Rework API to be more RESTful (references #139)
This commit is contained in:
@@ -18,10 +18,14 @@ class BaseApiController extends BaseController
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
protected function VoidApiActionResponse($response, $success = true, $status = 200, $errorMessage = '')
|
||||
protected function EmptyApiResponse($response, $status = 204)
|
||||
{
|
||||
return $response->withStatus($status);
|
||||
}
|
||||
|
||||
protected function GenericErrorResponse($response, $errorMessage, $status = 400)
|
||||
{
|
||||
return $response->withStatus($status)->withJson(array(
|
||||
'success' => $success,
|
||||
'error_message' => $errorMessage
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user