all repos

onasty @ 040181176b70c8c92db46c1158fc0a2d0e1abce4

a one-time notes service

onasty/web/src/Api/Me.elm (view raw)

Smirnov Oleksandr Smirnov Oleksandr
ss2316544@gmail.com
web: handle api errors (#138)..., 11 months ago
1
module Api.Me exposing (get)
2
3
import Api
4
import Data.Me as Me exposing (Me)
5
import Effect exposing (Effect)
6
import Http
7
8
9
get : { onResponse : Result Api.Error Me -> msg } -> Effect msg
10
get options =
11
    Effect.sendApiRequest
12
        { endpoint = "/api/v1/me"
13
        , method = "GET"
14
        , body = Http.emptyBody
15
        , onResponse = options.onResponse
16
        , decoder = Me.decode
17
        }