mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-24 06:54:03 +03:00
Add Logout Effect.
This commit is contained in:
parent
8cbe96e6b8
commit
042dddf764
@ -11,6 +11,7 @@ type Effect msg
|
||||
| Cmd (Cmd msg)
|
||||
| Batch (List (Effect msg))
|
||||
| GetStargazers (Result Http.Error Int -> msg)
|
||||
| Logout msg
|
||||
| FetchPageData
|
||||
{ body : Maybe { contentType : String, body : String }
|
||||
, path : Maybe String
|
||||
@ -61,6 +62,9 @@ map fn effect =
|
||||
, toMsg = fetchInfo.toMsg >> fn
|
||||
}
|
||||
|
||||
Logout msg ->
|
||||
Logout (fn msg)
|
||||
|
||||
|
||||
perform :
|
||||
{ fetchRouteData :
|
||||
@ -87,6 +91,17 @@ perform ({ fetchRouteData, fromPageMsg } as info) effect =
|
||||
Batch list ->
|
||||
Cmd.batch (List.map (perform info) list)
|
||||
|
||||
Logout toMsg ->
|
||||
fetchRouteData
|
||||
{ body =
|
||||
Just
|
||||
{ contentType = "application/json"
|
||||
, body = ""
|
||||
}
|
||||
, path = Just "/logout"
|
||||
, toMsg = \_ -> toMsg
|
||||
}
|
||||
|
||||
GetStargazers toMsg ->
|
||||
Http.get
|
||||
{ url = "https://api.github.com/repos/dillonkearns/elm-pages"
|
||||
|
Loading…
Reference in New Issue
Block a user