Nothing special and I'm a beginner so I might be doing something stupid but
I'm attempting to have some nested data in my model and this is the current
state of one of my update functions which is fairly painful.
update : Business.LocationList.Model.Msg -> Model -> ( Model, Cmd
Business.Model.Msg )
update msg model =
let
locationListData =
model.locationListData
in
case msg of
SetName name ->
let
data =
{ locationListData | name = name }
in
{ model | locationListData = data } ! []
Submit locationList ->
let
results =
validateEditLocationListForm model.locationListData
in
if List.length results > 0 then
let
data =
{ locationListData | errors = Just results }
in
{ model | locationListData = data } ! []
else
let
data =
{ locationListData | errors = Nothing }
in
{ model | locationListData = data } ! [
postUpdateLocationList locationListData locationList ]
Response locationList result ->
case result of
Ok value ->
let
locationLists =
List.map
(updateLocationListFromResponse
locationList.id model.locationListData)
model.locationLists
in
{ model | locationLists = locationLists }
! [ Task.perform GoToUrl (Task.succeed <|
url (ViewLocationListRoute locationList.id))
]
Err value ->
model ! []
>
>
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.