Browse Source

fixed error message on incorrect api key

pull/21/head
KodeStar 7 years ago
parent
commit
803ab459b1
  1. 9
      app/SupportedApps/Sabnzbd.php

9
app/SupportedApps/Sabnzbd.php

@ -9,7 +9,7 @@ class Sabnzbd implements Contracts\Applications, Contracts\Livestats {
public function defaultColour() public function defaultColour()
{ {
return '#655509'; return '#463b06';
} }
public function icon() public function icon()
{ {
@ -24,7 +24,12 @@ class Sabnzbd implements Contracts\Applications, Contracts\Livestats {
$res = $this->buildRequest('queue'); $res = $this->buildRequest('queue');
switch($res->getStatusCode()) { switch($res->getStatusCode()) {
case 200: case 200:
echo 'Successfully connected to the API'; $data = json_decode($res->getBody());
if(isset($data->error) && !empty($data->error)) {
echo 'Failed: '.$data->error;
} else {
echo 'Successfully connected to the API';
}
break; break;
case 401: case 401:
echo 'Failed: Invalid credentials'; echo 'Failed: Invalid credentials';

Loading…
Cancel
Save