In HTML pages with AP support, display link to pretty formatted JSON

This commit is contained in:
fr33domlover 2019-06-03 22:22:32 +00:00
parent 708f626294
commit 04a2e9a817

View file

@ -26,6 +26,7 @@ import Prelude
import Control.Exception
import Control.Monad.Logger.CallStack
import Data.ByteString (ByteString)
import Data.Foldable
import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
import Network.HTTP.Client
@ -131,4 +132,14 @@ provideHtmlAndAP object widget = do
[whamlet|
<div><pre>#{encodePrettyToLazyText doc}
|]
_ -> widget
_ -> do
widget
mroute <- getCurrentRoute
for_ mroute $ \ route -> do
params <- reqGetParams <$> getRequest
let pj = ("prettyjson", "true")
[whamlet|
<div>
<a href=@?{(route, pj : params)}>
[See JSON]
|]