Merge pull request #5021 from zaphodef/feature/return_sighting_add_rest

chg: Return the sighting when adding one through REST API
pull/5031/head
Andras Iklody 2019-08-20 13:45:55 +02:00 committed by GitHub
commit 69885806b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -90,8 +90,8 @@ class SightingsController extends AppController
}
} else {
if ($this->_isRest() || $this->response->type() === 'application/json') {
$this->set('message', __('Sighting added'));
$this->set('_serialize', array('message'));
$sighting = $this->Sighting->find('first', array('conditions' => array('Sighting.id' => $this->Sighting->id), 'recursive' => -1));
return $this->RestResponse->viewData($sighting, $this->response->type());
} else {
$this->Flash->success(__('Sighting added'));
$this->redirect($this->referer());