Improve make request in nano health controller

This commit is contained in:
Djery-Tom 2022-04-06 18:19:52 +01:00
parent bf82aea154
commit eca79fcabb
1 changed files with 30 additions and 27 deletions

View File

@ -409,7 +409,10 @@ class NanoHealthController extends CI_Controller
}
private function makeRequest($method , $path , $request_body = []){
if($this->isLogged()) {
if(!$this->isLogged()) {
return json_encode(['status' => 500]);
}
$url = NANO_SANTE_SERVICE_URL.$path;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
@ -434,10 +437,10 @@ class NanoHealthController extends CI_Controller
if ($result) {
return $result;
}
}
}else{
return json_encode(['status' => 500]);
}
}
public function storeExclusions(){
if($this->isLogged()) {