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