onasty/web/src/Data/Me.elm(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
module Data.Me exposing (Me, decode)
import Iso8601
import Json.Decode as Decode exposing (Decoder)
import Time exposing (Posix)
type alias Me =
{ email : String
, createdAt : Posix
, lastLoginAt : Posix
, notesCreated : Int
}
decode : Decoder Me
decode =
Decode.map4 Me
(Decode.field "email" Decode.string)
(Decode.field "created_at" Iso8601.decoder)
(Decode.field "last_login_at" Iso8601.decoder)
(Decode.field "notes_created" Decode.int)
|