Change message when no hubs are found. Add checking for null if no hubs are found. #653

This commit is contained in:
Korina Cordero 2022-03-24 07:44:03 +00:00
parent b7159c127c
commit c8629692e9

View file

@ -2675,7 +2675,7 @@ class APIController extends Controller implements LoggedController
if (empty($nearest_hub_slots['hub'])) if (empty($nearest_hub_slots['hub']))
{ {
$res->setError(true) $res->setError(true)
->setErrorMessage('Thank you for reaching out to us. Due to the General Community Quarantine, our Operations are from 8AM to 6PM only. Please expect a call from us tomorrow and we will assist you with your request. Thank you and stay safe!'); ->setErrorMessage('Thank you for reaching out to us. Please expect a call from us and we will assist you with your request. Thank you and stay safe!');
return $res->getReturnResponse(); return $res->getReturnResponse();
} }
} }
@ -2687,7 +2687,7 @@ class APIController extends Controller implements LoggedController
if (empty($nearest_hub_slots['hub'])) if (empty($nearest_hub_slots['hub']))
{ {
$res->setError(true) $res->setError(true)
->setErrorMessage('Thank you for reaching out to us. Due to the General Community Quarantine, our Operations are from 8AM to 6PM only. Please expect a call from us tomorrow and we will assist you with your request. Thank you and stay safe!'); ->setErrorMessage('Thank you for reaching out to us. Please expect a call from us and we will assist you with your request. Thank you and stay safe!');
return $res->getReturnResponse(); return $res->getReturnResponse();
} }
} }
@ -4365,11 +4365,14 @@ class APIController extends Controller implements LoggedController
} }
} }
// set hub data to what is in nearest if ($nearest != null)
$hub_data = [ {
'hub' => $nearest['hub'], // set hub data to what is in nearest
'slots' => $hub_slots['slot_data'], $hub_data = [
]; 'hub' => $nearest['hub'],
'slots' => $hub_slots['slot_data'],
];
}
return $hub_data; return $hub_data;