Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- withLoggedInUser :: (Db.User -> H ()) -> H ()
- withLoggedInUser action =
- with auth currentUser >>= go
- where
- go Nothing =
- with auth $ handleLoginGet (Just "You are currently not logged in. Thou shall not pass.")
- go (Just user) = logRunEitherT $ do
- uid <- tryJust "withLoggedInUser: missing uid" (userId user)
- uid' <- hoistEither (reader T.decimal (unUid uid))
- return $ action (Db.User uid' (userLogin user))
- Funcites oproepen gebeurt dan zo:
- , ("/new_user", with auth handleNewUser)
- , ("/events", handleViewAllEvents)
- handleViewAllEvents :: H()
- handleViewAllEvents = method GET (withLoggedInUser (viewEventList Nothing))
- viewEventList :: Maybe T.Text -> Db.User -> H()
- viewEventList err _ =
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement