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.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js
index 938614e..28aaad3 100644
--- a/src/client/react/components/container/View.js
+++ b/src/client/react/components/container/View.js
@@ -24,7 +24,6 @@ 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';
import Schedule from '../presentational/Schedule';
@@ -66,7 +65,28 @@ class View extends React.Component {
const schedule = extractSchedule(schedules, user, week);
if (schedule.state === 'NOT_REQUESTED') {
- dispatch(fetchSchedule(user, week));
+ fetch(`/get/${user}?week=${week}`).then(
+ // success
+ (r) => {
+ r.text().then((htmlStr) => {
+ dispatch({
+ type: 'VIEW/FETCH_SCHEDULE_SUCCESS',
+ user,
+ week,
+ htmlStr,
+ });
+ });
+ },
+
+ // error
+ () => {
+ dispatch({
+ type: 'VIEW/FETCH_SCHEDULE_FAILURE',
+ week,
+ user,
+ });
+ },
+ );
}
}