mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 12:52:27 +03:00
Use helper function.
This commit is contained in:
parent
2d912ffcb3
commit
c6986fc1fc
@ -160,42 +160,11 @@ action routeParams =
|
||||
)
|
||||
|
||||
Ok (CheckAll toggleTo) ->
|
||||
okSessionThing
|
||||
|> Session.get "sessionId"
|
||||
|> Maybe.map Data.Session.get
|
||||
|> Maybe.map Request.Hasura.dataSource
|
||||
|> Maybe.map
|
||||
(DataSource.andThen
|
||||
(\maybeUserSession ->
|
||||
let
|
||||
bar : Maybe Uuid
|
||||
bar =
|
||||
maybeUserSession
|
||||
|> Maybe.map .id
|
||||
in
|
||||
case bar of
|
||||
Nothing ->
|
||||
DataSource.succeed
|
||||
( okSessionThing
|
||||
, Response.render {}
|
||||
)
|
||||
|
||||
Just userId ->
|
||||
withUserSession session
|
||||
(\userId ->
|
||||
Data.Todo.toggleAllTo userId toggleTo
|
||||
|> Request.Hasura.mutationDataSource
|
||||
|> DataSource.map
|
||||
(\() ->
|
||||
( okSessionThing
|
||||
, Response.render {}
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|> Maybe.withDefault
|
||||
(DataSource.succeed
|
||||
( okSessionThing
|
||||
, Response.render {}
|
||||
)
|
||||
|> DataSource.map (\() -> Response.render {})
|
||||
)
|
||||
|
||||
Ok DeleteComplete ->
|
||||
|
Loading…
Reference in New Issue
Block a user