-- Polling CSR status
handlePollCSRState :: AppState -> ActionM ()
handlePollCSRState state = do
  csrId    <- param "csrid"
  maybeCsr <- query' state $ RetrieveCSR csrId
  case maybeCsr of
    Nothing -> serveError notFound404 "Could not find CSR"
    (Just csr) -> json $ csr ^. requestStatus

-- Retrieving certificates
handlePollCSRState :: AppState -> ActionM ()
handlePollCSRState state = do
  csrId    <- param "csrid"
  maybeCsr <- query' state $ RetrieveCSR csrId
  case maybeCsr of
    Nothing -> serveError notFound404 "Could not find CSR"
    (Just csr) -> json $ csr ^. requestStatus

-- Retrieving certificates
handlePollCSRState state = do
  csrId    <- param "csrid"
  maybeCsr <- query' state $ RetrieveCSR csrId
  case maybeCsr of
    Nothing -> serveError notFound404 "Could not find CSR"
    (Just csr) -> json $ csr ^. requestStatus

-- Retrieving certificates