From 449f76cb30be714ef2cec79fa0c53c03773b248d Mon Sep 17 00:00:00 2001 From: Cadey Dodrill Date: Wed, 14 Dec 2016 08:24:52 -0800 Subject: Autoload blogposts on the blog page --- frontend/src/Layout.purs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'frontend/src/Layout.purs') 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 -- cgit v1.2.3