FIx fetch
All checks were successful
repod / nextcloud (push) Successful in 1m9s
repod / nodejs (push) Successful in 1m34s

This commit is contained in:
Michel Roux 2023-08-23 09:08:13 +02:00
parent eee1380734
commit 9f52367b86

View File

@ -26,10 +26,10 @@ class FetchController extends Controller
public function index(string $url): JSONResponse
{
$podcastData = $this->podcastDataReader->getCachedOrFetchPodcastData($url, $this->userService->getUserUID());
$podcasts = $this->podcastDataReader->getCachedOrFetchPodcastData($url, $this->userService->getUserUID());
if ($podcastData) {
return new JSONResponse(['data' => $podcastData->toArray()]);
if ($podcasts) {
return new JSONResponse(['data' => $podcasts]);
}
$client = $this->clientService->newClient();
@ -40,8 +40,8 @@ class FetchController extends Controller
throw new \ErrorException("Web request returned non-2xx status code: {$statusCode}");
}
$podcastData = PodcastData::parseRssXml((string) $feed->getBody());
$podcasts = PodcastData::parseRssXml((string) $feed->getBody());
return new JSONResponse(['data' => $podcastData->toArray()]);
return new JSONResponse(['data' => $podcasts]);
}
}