aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/BlogIndex.purs
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2016-12-14 11:54:17 -0800
committerChristine Dodrill <me@christine.website>2016-12-14 11:54:17 -0800
commit81206835d5ddb8760086085d758b049f73ea0801 (patch)
treeb1a26f35e5c5a8c60bf620438fc3a5c424e2f113 /frontend/src/BlogIndex.purs
parent4a52f5006bc8c1e63d68c2bad04c7e3f33a6e11d (diff)
downloadxesite-81206835d5ddb8760086085d758b049f73ea0801.tar.xz
xesite-81206835d5ddb8760086085d758b049f73ea0801.zip
frontend: render blog posts
Diffstat (limited to 'frontend/src/BlogIndex.purs')
-rw-r--r--frontend/src/BlogIndex.purs9
1 files changed, 5 insertions, 4 deletions
diff --git a/frontend/src/BlogIndex.purs b/frontend/src/BlogIndex.purs
index d1b19f6..a52e6bd 100644
--- a/frontend/src/BlogIndex.purs
+++ b/frontend/src/BlogIndex.purs
@@ -39,15 +39,15 @@ instance decodeJsonPost :: DecodeJson Post where
init :: State
init =
{ posts: []
- , status: "Loading..." }
+ , status: "" }
update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM)
update (ReceivePosts (Left err)) state =
noEffects $ state { status = ("error: " <> err) }
update (ReceivePosts (Right posts)) state =
- noEffects $ state { posts = posts, status = "Posts" }
+ noEffects $ state { posts = posts, status = "" }
update RequestPosts state =
- { state: state { status = "Fetching posts..." }
+ { state: state { status = "Loading..." }
, effects: [ do
res <- attempt $ get "/api/blog/posts"
let decode r = decodeJson r.response :: Either String Posts
@@ -79,5 +79,6 @@ view :: State -> Html Action
view state =
div
[]
- [ h1 [] [ text state.status ]
+ [ h1 [] [ text "Posts" ]
+ , p [] [ text state.status ]
, div [ className "row" ] $ map post state.posts ]