Fixed: Throw exception when getting courses

This commit is contained in:
philipp lang 2022-01-11 02:38:18 +01:00
parent 21158cd5e2
commit 2d66d23f6c
1 changed files with 4 additions and 0 deletions

View File

@ -210,6 +210,10 @@ class Api {
$url = self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/flist"; $url = self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/flist";
$response = $this->http()->get($url); $response = $this->http()->get($url);
if (!$response->ok() || $response->json()['success'] === false) {
throw new RightException('Getting courses for member '.$memberId.' failed');
}
return collect($response->json()['data'])->map(function($course) use ($memberId) { return collect($response->json()['data'])->map(function($course) use ($memberId) {
$single = $this->http()->get(self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/{$course['id']}")['data']; $single = $this->http()->get(self::$url."/ica/rest/nami/mitglied-ausbildung/filtered-for-navigation/mitglied/mitglied/{$memberId}/{$course['id']}")['data'];