protected function onAfterExecute($task)
{
// JSON shouldn't have redirects
if ($this->hasRedirect() && $this->input->getCmd('format', 'html') == 'json') {
// Error: deal with it in REST api way
if ($this->messageType == 'error') {
$response = new \JResponseJson($this->message, $this->message, true);
echo $response;
$this->redirect = false;
$this->container->platform->setHeader('Status', 500);
return;
} else {
// Not an error, avoid redirect and display the record(s)
$this->redirect = false;
return $this->display();
}
}
return true;
}