diff options
author | Joris | 2015-11-01 19:47:24 +0100 |
---|---|---|
committer | Joris | 2015-11-01 19:47:24 +0100 |
commit | 51d1ff2273315ad1270794499d0c49e8fb99aba5 (patch) | |
tree | 8a3027d9fe2865731e0111989bc84eaea1591270 /src/server/Json.hs | |
parent | f76aaedd794f15d9f049f53a081710b9565fb8b1 (diff) |
Store the sign in token instead of the login in the session cookie
Diffstat (limited to 'src/server/Json.hs')
-rw-r--r-- | src/server/Json.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/server/Json.hs b/src/server/Json.hs index 51287ed..bd5ac3e 100644 --- a/src/server/Json.hs +++ b/src/server/Json.hs @@ -1,12 +1,22 @@ +{-# LANGUAGE OverloadedStrings #-} + module Json - ( jsonObject + ( jsonError + , jsonObject ) where -import Web.Scotty (json, ActionM) +import Web.Scotty + +import Network.HTTP.Types.Status (badRequest400) import qualified Data.Aeson.Types as Json import qualified Data.HashMap.Strict as M import Data.Text (Text) +jsonError :: Text -> ActionM () +jsonError msg = do + status badRequest400 + jsonObject [("error", Json.String msg)] + jsonObject :: [(Text, Json.Value)] -> ActionM () jsonObject = json . Json.Object . M.fromList |