Revise 2.

This commit is contained in:
Richard Feldman
2016-03-25 22:42:04 -07:00
parent b70d960719
commit ee9c95499d
2 changed files with 6 additions and 14 deletions

View File

@@ -91,26 +91,19 @@ viewSearchResult address result =
]
[ text result.name ]
, button
-- TODO add an onClick handler that sends a HideById action
-- TODO add an onClick handler that sends a HIDE_BY_ID action
[ class "hide-result" ]
[ text "X" ]
]
type alias Action =
{ actionType : String
, payload : Int
{ -- TODO implement this type alias
}
update : Action -> Model -> Model
update action model =
if action.actionType == "HIDE_BY_ID" then
let
-- TODO build a new model without the given ID present anymore.
newModel =
model
in
newModel
else
model
-- TODO if we receive a HIDE_BY_ID action,
-- build a new model without the given ID present anymore.
model

View File

@@ -155,8 +155,7 @@ update action model =
HideById idToHide ->
let
newResults =
model.results
|> List.filter (\{ id } -> id /= idToHide)
List.filter (\{ id } -> id /= idToHide) model.results
newModel =
{ model | results = newResults }