From 51d1ff2273315ad1270794499d0c49e8fb99aba5 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 1 Nov 2015 19:47:24 +0100 Subject: Store the sign in token instead of the login in the session cookie --- src/server/Json.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/server/Json.hs') 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 -- cgit v1.2.3