Hello. I would like to know how to update the performLoginHandle to take the loginForm object from the request body, while also having a PostgresConnection argument.
type PostgresConnection = Database.HDBC.PostgreSQL.Connection
data LoginForm = LoginForm
{ username :: String
, password :: String
, nextUrl :: String
} deriving (Eq, Show, Generic)
instance ToJSON LoginForm
instance FromJSON LoginForm
type PerformLoginRoute = "perform-login" :> ReqBody '[JSON] LoginForm :> Get '[HTMLLucid] (Html ())
performLoginHandle :: PostgresConnection -> Server PerformLoginRoute
performLoginHandle conn = "not_implemented" -- redirect to success_page or error_page
pageserver :: PostgresConnection -> Application
pageserver conn = serve router (performLoginHandle conn)