aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/Update.elm
blob: d1a3239eb717e2f374afdbdaa0ef54a5d56e9875 (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
module LoggedIn.Home.Update exposing
  ( update
  )

import Form exposing (Form)

import LoggedData exposing (LoggedData)

import LoggedIn.Home.Msg as Home
import LoggedIn.Home.Model as Home

update : LoggedData -> Home.Msg -> Home.Model -> (Home.Model, Cmd Home.Msg)
update loggedData msg model =
  case msg of

    Home.NoOp ->
      ( model
      , Cmd.none
      )

    Home.UpdatePage page ->
      ( { model | currentPage = page }
      , Cmd.none
      )

    Home.SearchMsg formMsg ->
      ( { model
        | search = Form.update formMsg model.search
        , currentPage =
            case formMsg of
              Form.Input "name" _ -> 1
              _ -> model.currentPage
        }
      , Cmd.none
      )