From 50671ed027f874992ac50cfb21e123f579440737 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Mon, 19 Feb 2018 20:24:37 +0100 Subject: Remove action creators --- src/client/react/components/container/View.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/client/react/components/container/View.js') 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, + }); + }, + ); } } -- cgit v1.1