Make yourFeed the default
This commit is contained in:
@@ -33,7 +33,7 @@ init session =
|
|||||||
if session.user == Nothing then
|
if session.user == Nothing then
|
||||||
SelectList.singleton globalFeed
|
SelectList.singleton globalFeed
|
||||||
else
|
else
|
||||||
SelectList.fromLists [] yourFeed [ globalFeed ]
|
SelectList.fromLists [] globalFeed [ yourFeed ]
|
||||||
|
|
||||||
loadTags =
|
loadTags =
|
||||||
Request.Article.tags
|
Request.Article.tags
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ init session =
|
|||||||
if session.user == Nothing then
|
if session.user == Nothing then
|
||||||
SelectList.singleton globalFeed
|
SelectList.singleton globalFeed
|
||||||
else
|
else
|
||||||
SelectList.fromLists [] yourFeed [ globalFeed ]
|
SelectList.fromLists [] globalFeed [ yourFeed ]
|
||||||
|
|
||||||
loadTags =
|
loadTags =
|
||||||
Request.Article.tags
|
Request.Article.tags
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ init session =
|
|||||||
if session.user == Nothing then
|
if session.user == Nothing then
|
||||||
SelectList.singleton globalFeed
|
SelectList.singleton globalFeed
|
||||||
else
|
else
|
||||||
SelectList.fromLists [] yourFeed [ globalFeed ]
|
SelectList.fromLists [] globalFeed [ yourFeed ]
|
||||||
|
|
||||||
loadTags =
|
loadTags =
|
||||||
Request.Article.tags
|
Request.Article.tags
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ init session =
|
|||||||
if session.user == Nothing then
|
if session.user == Nothing then
|
||||||
SelectList.singleton globalFeed
|
SelectList.singleton globalFeed
|
||||||
else
|
else
|
||||||
SelectList.fromLists [] yourFeed [ globalFeed ]
|
SelectList.fromLists [] globalFeed [ yourFeed ]
|
||||||
|
|
||||||
loadTags =
|
loadTags =
|
||||||
Request.Article.tags
|
Request.Article.tags
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ Then open [http://localhost:3000](http://localhost:3000) in your browser.
|
|||||||
|
|
||||||
## Exercise
|
## Exercise
|
||||||
|
|
||||||
Open `src/Page/Article/Editor.elm` in your editor and resolve the TODOs there.
|
Open `src/Data/Article/Feed.elm` in your editor and resolve the TODOs there.
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ init session =
|
|||||||
if session.user == Nothing then
|
if session.user == Nothing then
|
||||||
SelectList.singleton globalFeed
|
SelectList.singleton globalFeed
|
||||||
else
|
else
|
||||||
SelectList.fromLists [] yourFeed [ globalFeed ]
|
SelectList.fromLists [] globalFeed [ yourFeed ]
|
||||||
|
|
||||||
loadTags =
|
loadTags =
|
||||||
Request.Article.tags
|
Request.Article.tags
|
||||||
|
|||||||
@@ -134,34 +134,31 @@ update session msg model =
|
|||||||
|
|
||||||
Just user ->
|
Just user ->
|
||||||
let
|
let
|
||||||
-- TODO
|
{-
|
||||||
-- 1) head over to the Request.Profile module and look up
|
TODO
|
||||||
-- what arguments the `toggleFollow` function takes.
|
1) head over to the src/Request/Profile.elm and look up
|
||||||
--
|
what arguments the `toggleFollow` function takes.
|
||||||
-- 2) call Request.Profile.toggleFollow here,
|
|
||||||
-- to get back a Request.
|
2) call `Request.Profile.toggleFollow` here,
|
||||||
--
|
to get back a `Http.Request`.
|
||||||
-- 3) pass that Request to Http.send to get a Cmd.
|
|
||||||
-- Use that Cmd here.
|
3) pass that `Http.Request` to `Http.send` to get a `Cmd`.
|
||||||
--
|
Use that `Cmd` here.
|
||||||
-- Here's the documentation for Http.send:
|
|
||||||
-- http://package.elm-lang.org/packages/elm-lang/http/1.0.0/Http#send
|
Here's the documentation for Http.send:
|
||||||
--
|
http://package.elm-lang.org/packages/elm-lang/http/1.0.0/Http#send
|
||||||
-- Here are some hepful values that are in scope:
|
|
||||||
--
|
Here are some hepful values that are in scope:
|
||||||
-- user.token : Maybe AuthToken
|
|
||||||
--
|
user.token : Maybe AuthToken
|
||||||
-- profile : Profile [look in the Data.Profile module!]
|
|
||||||
--
|
profile : Profile [look in the src/Data/Profile.elm module!]
|
||||||
-- FollowCompleted : Result Http.Error Profile -> Msg
|
|
||||||
--
|
FollowCompleted : Result Http.Error Profile -> Msg
|
||||||
|
-}
|
||||||
cmd : Cmd Msg
|
cmd : Cmd Msg
|
||||||
cmd =
|
cmd =
|
||||||
Request.Profile.toggleFollow
|
Cmd.none
|
||||||
profile.username
|
|
||||||
profile.following
|
|
||||||
user.token
|
|
||||||
|> Http.send FollowCompleted
|
|
||||||
in
|
in
|
||||||
( model, cmd )
|
( model, cmd )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user