mirror of https://github.com/MISP/MISP
fix: Updated the new ajax methods to follow the new JSON rules
parent
ead2b9e1fd
commit
5d9cfe5d6c
|
@ -93,14 +93,14 @@ class ObjectReferencesController extends AppController {
|
|||
'conditions' => array('ObjectReference' => $this->ObjectReference->id)
|
||||
));
|
||||
return $this->RestResponse->viewData($object, $this->response->type());
|
||||
} else {
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => true, 'success' => 'Object reference added.')),'status'=>200));
|
||||
} else if ($this->request->is('ajax')) {
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => true, 'success' => 'Object reference added.')),'status'=>200, 'type' => 'json'));
|
||||
}
|
||||
} else {
|
||||
if ($this->_isRest()) {
|
||||
return $this->RestResponse->saveFailResponse('ObjectReferences', 'add', false, $this->ObjectReference->validationErrors, $this->response->type());
|
||||
} else if ($this->request->is('ajax')) {
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'errors' => 'Object reference could not be added.')),'status'=>200));
|
||||
return new CakeResponse(array('body'=> json_encode(array('saved' => false, 'errors' => 'Object reference could not be added.')),'status'=>200, 'type' => 'json'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -262,7 +262,8 @@ class ObjectsController extends AppController {
|
|||
'success' => $message
|
||||
)
|
||||
),
|
||||
'status'=>200
|
||||
'status'=>200,
|
||||
'type' => 'json'
|
||||
)
|
||||
);
|
||||
} else if ($this->_isRest()) {
|
||||
|
@ -281,13 +282,15 @@ class ObjectsController extends AppController {
|
|||
if ($this->request->is('ajax')) {
|
||||
return new CakeResponse(
|
||||
array(
|
||||
'body'=> json_encode(
|
||||
array(
|
||||
'saved' => false,
|
||||
'errors' => $message
|
||||
)
|
||||
),
|
||||
'status'=>200)
|
||||
'body'=> json_encode(
|
||||
array(
|
||||
'saved' => false,
|
||||
'errors' => $message
|
||||
)
|
||||
),
|
||||
'status'=>200,
|
||||
'type' => 'json'
|
||||
)
|
||||
);
|
||||
} else if ($this->_isRest()) {
|
||||
return $this->RestResponse->saveFailResponse(
|
||||
|
|
Loading…
Reference in New Issue