From 74a826fbb4adc2c11bc82717f3990592e9ed983b Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 10 Apr 2012 18:55:57 +0300 Subject: [PATCH] clearSession --- yesod-core/Yesod/Handler.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/yesod-core/Yesod/Handler.hs b/yesod-core/Yesod/Handler.hs index bddb18b7..ae8ee730 100644 --- a/yesod-core/Yesod/Handler.hs +++ b/yesod-core/Yesod/Handler.hs @@ -76,6 +76,7 @@ module Yesod.Handler , setSession , setSessionBS , deleteSession + , clearSession -- ** Ultimate destination , setUltDest , setUltDestCurrent @@ -700,6 +701,12 @@ setSessionBS k = modify . modSession . Map.insert k deleteSession :: Text -> GHandler sub master () deleteSession = modify . modSession . Map.delete +-- | Clear all session variables. +-- +-- Since: 1.0.1 +clearSession :: GHandler sub master () +clearSession = modify $ \x -> x { ghsSession = Map.empty } + modSession :: (SessionMap -> SessionMap) -> GHState -> GHState modSession f x = x { ghsSession = f $ ghsSession x }