FIx fetch
This commit is contained in:
parent
eee1380734
commit
9f52367b86
@ -26,10 +26,10 @@ class FetchController extends Controller
|
|||||||
|
|
||||||
public function index(string $url): JSONResponse
|
public function index(string $url): JSONResponse
|
||||||
{
|
{
|
||||||
$podcastData = $this->podcastDataReader->getCachedOrFetchPodcastData($url, $this->userService->getUserUID());
|
$podcasts = $this->podcastDataReader->getCachedOrFetchPodcastData($url, $this->userService->getUserUID());
|
||||||
|
|
||||||
if ($podcastData) {
|
if ($podcasts) {
|
||||||
return new JSONResponse(['data' => $podcastData->toArray()]);
|
return new JSONResponse(['data' => $podcasts]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = $this->clientService->newClient();
|
$client = $this->clientService->newClient();
|
||||||
@ -40,8 +40,8 @@ class FetchController extends Controller
|
|||||||
throw new \ErrorException("Web request returned non-2xx status code: {$statusCode}");
|
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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user