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 diff --git a/frontend/support/index.html b/frontend/support/index.html index 3b53f83..86b06a4 100644 --- a/frontend/support/index.html +++ b/frontend/support/index.html @@ -14,30 +14,5 @@
- -