aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/container/View.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/components/container/View.js')
-rw-r--r--src/client/react/components/container/View.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js
index 4f16100..052173f 100644
--- a/src/client/react/components/container/View.js
+++ b/src/client/react/components/container/View.js
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
+import { userFromMatch, weekFromLocation } from '../../lib/url';
import { fetchSchedule } from '../../actions/view';
import extractSchedule from '../../lib/extractSchedule';
@@ -11,10 +12,12 @@ import Loading from '../presentational/Loading';
const View = ({
schedules,
- user,
- week,
+ match,
+ location,
dispatch,
}) => {
+ const user = userFromMatch(match);
+ const week = weekFromLocation(location);
const schedule = extractSchedule(schedules, user, week);
switch (schedule.state) {
@@ -35,8 +38,15 @@ View.propTypes = {
state: PropTypes.string.isRequired,
htmlStr: PropTypes.string,
}))).isRequired,
- user: PropTypes.string.isRequired,
- week: PropTypes.number.isRequired,
+ match: PropTypes.shape({
+ params: PropTypes.shape({
+ type: PropTypes.string.isRequired,
+ value: PropTypes.string.isRequired,
+ }).isRequired,
+ }).isRequired,
+ location: PropTypes.shape({
+ search: PropTypes.string.isRequired,
+ }).isRequired,
dispatch: PropTypes.func.isRequired,
};