diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-02-19 23:04:20 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-02-19 23:04:20 +0100 |
commit | a345bd0f554ec83b5b994752f30dca9d09dc9e67 (patch) | |
tree | 04f31c3d3634b0ee5597d1e63f36f2eb54c0a245 | |
parent | df1af158484b25c2a250c3ff3b3c72df2c562bb3 (diff) |
Simplify nested Promise
-rw-r--r-- | src/client/react/components/container/View.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/client/react/components/container/View.js b/src/client/react/components/container/View.js index 7c0d42c..407a7de 100644 --- a/src/client/react/components/container/View.js +++ b/src/client/react/components/container/View.js @@ -65,16 +65,14 @@ class View extends React.Component { const schedule = extractSchedule(schedules, user, week); if (schedule.state === 'NOT_REQUESTED') { - fetch(`/get/${user}?week=${week}`).then( + fetch(`/get/${user}?week=${week}`).then(r => r.text()).then( // success - (r) => { - r.text().then((htmlStr) => { - dispatch({ - type: 'VIEW/FETCH_SCHEDULE_SUCCESS', - user, - week, - htmlStr, - }); + (htmlStr) => { + dispatch({ + type: 'VIEW/FETCH_SCHEDULE_SUCCESS', + user, + week, + htmlStr, }); }, |