From 7bc954b779a9bc4e1c5e60f2648101c62ed22e72 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 14 Mar 2017 18:33:42 +0100 Subject: Reference & list --- Handler/Item.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Handler/Item.hs') diff --git a/Handler/Item.hs b/Handler/Item.hs index 87030bb..0f48261 100644 --- a/Handler/Item.hs +++ b/Handler/Item.hs @@ -4,12 +4,10 @@ import Import getItemR :: ItemId -> Handler TypedContent getItemR itemId = do - eLookup <- runDB $ fmap (Entity itemId) <$> get itemId - case eLookup of - Nothing -> notFound - Just entity -> selectRep $ do - provideJson entity - provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html) + entity <- runDB $ Entity itemId <$> get404 itemId + selectRep $ do + provideJson entity + provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html) putItemR :: ItemId -> Handler Value putItemR itemId = do -- cgit v1.2.3