diff options
| author | Cadey Dodrill <me@christine.website> | 2016-12-14 08:24:52 -0800 |
|---|---|---|
| committer | Cadey Dodrill <me@christine.website> | 2016-12-14 08:24:52 -0800 |
| commit | 449f76cb30be714ef2cec79fa0c53c03773b248d (patch) | |
| tree | bb2a0c590f3a15ddfd68fd5a3e9b3b3872c3cde3 /frontend/src | |
| parent | 90f176019a1723aa0d4b7cbb97009944e60e963d (diff) | |
| download | xesite-449f76cb30be714ef2cec79fa0c53c03773b248d.tar.xz xesite-449f76cb30be714ef2cec79fa0c53c03773b248d.zip | |
Autoload blogposts on the blog page
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/BlogIndex.purs | 1 | ||||
| -rw-r--r-- | frontend/src/Layout.purs | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/frontend/src/BlogIndex.purs b/frontend/src/BlogIndex.purs index 8f2c919..d1b19f6 100644 --- a/frontend/src/BlogIndex.purs +++ b/frontend/src/BlogIndex.purs @@ -80,5 +80,4 @@ view state = div [] [ h1 [] [ text state.status ] - , button [ onClick (const RequestPosts), id_ "requestbutton", className "hidden" ] [ text "Fetch posts" ] , div [ className "row" ] $ map post state.posts ] diff --git a/frontend/src/Layout.purs b/frontend/src/Layout.purs index 93ffa4a..f040108 100644 --- a/frontend/src/Layout.purs +++ b/frontend/src/Layout.purs @@ -28,12 +28,17 @@ init = , bistate: BlogIndex.init } update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (PageView route) state = noEffects $ state { route = route } +update (PageView route) state = routeEffects route $ state { route = route } update (BIChild action) state = BlogIndex.update action state.bistate # mapState (state { bistate = _ }) # mapEffects BIChild update (Child action) state = noEffects $ state { count = Counter.update action state.count } +routeEffects :: Route -> State -> EffModel State Action (dom :: DOM, ajax :: AJAX) +routeEffects BlogIndex state = { state: state + , effects: [ pure BlogIndex.RequestPosts ] } # mapEffects BIChild +routeEffects _ state = noEffects $ state + view :: State -> Html Action view state = div |
