1 import axios from 'axios';
2 import moment from 'moment';
3 import React from 'react';
4 import { Container } from 'react-bootstrap';
5 import { Helmet } from 'react-helmet';
6 import { useTranslation } from 'react-i18next';
8 import CanonicalLinks from '../common/CanonicalLinks';
9 import ErrorBoundary from '../common/ErrorBoundary';
10 import List from '../episodes/List';
12 const Schedule = () => {
13 const [ahead, setAhead] = React.useState(6);
14 const [behind, setBehind] = React.useState(0);
15 const [episodes, setEpisodes] = React.useState([]);
17 const { t } = useTranslation();
19 React.useEffect(() => {
20 const controller = new AbortController();
21 axios.get(`/api/episodes`, {
22 signal: controller.signal,
24 after: moment().startOf('day').subtract(behind, 'days').toISOString(),
25 before: moment().startOf('day').add(ahead + 1, 'days').toISOString(),
28 setEpisodes(response.data || []);
30 if (!axios.isCancel(e)) {
41 <title>{t('schedule.heading')}</title>
42 <meta name="description" content={t('schedule.description')} />
44 <CanonicalLinks base="/schedule" />
45 <h1>{t('schedule.heading')}</h1>
47 <List episodes={episodes} />
52 export default Schedule;