Skip to content

Commit

Permalink
fix(series): fix start watching button url
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristiaanScheermeijer committed Jun 1, 2022
1 parent 4a7cba7 commit 833c364
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/containers/StartWatchingButton/StartWatchingButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useCheckoutStore } from '#src/stores/CheckoutStore';
import type { PlaylistItem } from '#types/playlist';
import { useWatchHistoryStore } from '#src/stores/WatchHistoryStore';
import { useAccountStore } from '#src/stores/AccountStore';
import { getSeriesId, isEpisode } from '#src/utils/media';
import { getSeriesIdFromEpisode } from '#src/utils/media';
import { episodeURLFromEpisode, videoUrl } from '#src/utils/formatting';

type Props = {
Expand Down Expand Up @@ -49,9 +49,9 @@ const StartWatchingButton: React.VFC<Props> = ({ item }) => {
}, [isEntitled, isLoggedIn, hasMediaOffers, videoProgress, t]);

const handleStartWatchingClick = useCallback(() => {
const seriesId = getSeriesId(item);
const seriesId = getSeriesIdFromEpisode(item);
const playlistId = searchParams.get('r');
const videoPlayUrl = isEpisode(item) && seriesId ? episodeURLFromEpisode(item, seriesId, playlistId, true) : videoUrl(item, playlistId, true);
const videoPlayUrl = seriesId ? episodeURLFromEpisode(item, seriesId, playlistId, true) : videoUrl(item, playlistId, true);

if (isEntitled) return videoPlayUrl && history.push(videoPlayUrl);
if (!isLoggedIn) return history.push(addQueryParam(history, 'u', 'create-account'));
Expand Down

0 comments on commit 833c364

Please sign in to comment.