diff --git a/assets/utils/api/index.ts b/assets/utils/api/index.ts index c4978d2..c8111c4 100644 --- a/assets/utils/api/index.ts +++ b/assets/utils/api/index.ts @@ -64,7 +64,7 @@ export interface User { roles: string[] } -export interface Watchlist { +export interface Watchlist { domains: string[], triggers: { event: EventAction, action: TriggerAction }[], connector?: string @@ -76,8 +76,8 @@ export async function request, D = any>(config: Ax baseURL: '/api', withCredentials: true, headers: { + Accept: 'application/ld+json', ...config.headers, - Accept: 'application/ld+json' } } return await axios.request(axiosConfig) diff --git a/src/Controller/WatchListController.php b/src/Controller/WatchListController.php index 81bef0b..f7b41b7 100644 --- a/src/Controller/WatchListController.php +++ b/src/Controller/WatchListController.php @@ -25,7 +25,6 @@ use Sabre\VObject\Reader; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Serializer\SerializerInterface; @@ -67,6 +66,7 @@ class WatchListController extends AbstractController * @throws ParseException * @throws EofException * @throws InvalidDataException + * @throws Exception */ #[Route( path: '/api/watchlists/{token}/calendar', @@ -78,10 +78,8 @@ class WatchListController extends AbstractController )] public function getWatchlistCalendar(string $token): Response { + /** @var WatchList $watchList */ $watchList = $this->watchListRepository->findOneBy(["token" => $token]); - /** @var User $user */ - $user = $this->getUser(); - if (!$user->getWatchLists()->contains($watchList)) throw new UnauthorizedHttpException(''); $calendar = new Calendar();