diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-02-19 20:24:37 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-02-19 20:24:37 +0100 |
commit | 50671ed027f874992ac50cfb21e123f579440737 (patch) | |
tree | 6f03e9f18151c12777a6122593eec2be63247c84 /src/client/react/components/container/View.js | |
parent | 7250c51f716a050c105aae4e9f46d9736e108654 (diff) |
Remove action creators
Diffstat (limited to 'src/client/react/components/container/View.js')
-rw-r--r-- | src/client/react/components/container/View.js | 24 |
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, + }); + }, + ); } } |