blob: 18b2077c1cea7b8b44ee1811b883df5b012990bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
module ElmModule.Update exposing (update)
-- Elm -------------------------------------------------------------------------
-- Main Menu -------------------------------------------------------------------
import Struct.Event
import Struct.Model
import Update.HandleServerReply
import Update.SelectTab
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
update : (
Struct.Event.Type ->
Struct.Model.Type ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
update event model =
let
new_model = (Struct.Model.clear_error model)
in
case event of
Struct.Event.None -> (model, Cmd.none)
(Struct.Event.Failed err) ->
(
(Struct.Model.invalidate err new_model),
Cmd.none
)
(Struct.Event.ServerReplied result) ->
(Update.HandleServerReply.apply_to model result)
|