FIx fetch

This commit is contained in:
Michel Roux 2023-08-23 09:08:13 +02:00
parent eee1380734
commit 9f52367b86
1 changed files with 5 additions and 5 deletions

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]);
}
}