diff options
Diffstat (limited to 'Handler/Item.hs')
-rw-r--r-- | Handler/Item.hs | 10 |
1 files changed, 4 insertions, 6 deletions
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 | |||
4 | 4 | ||
5 | getItemR :: ItemId -> Handler TypedContent | 5 | getItemR :: ItemId -> Handler TypedContent |
6 | getItemR itemId = do | 6 | getItemR itemId = do |
7 | eLookup <- runDB $ fmap (Entity itemId) <$> get itemId | 7 | entity <- runDB $ Entity itemId <$> get404 itemId |
8 | case eLookup of | 8 | selectRep $ do |
9 | Nothing -> notFound | 9 | provideJson entity |
10 | Just entity -> selectRep $ do | 10 | provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html) |
11 | provideJson entity | ||
12 | provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html) | ||
13 | 11 | ||
14 | putItemR :: ItemId -> Handler Value | 12 | putItemR :: ItemId -> Handler Value |
15 | putItemR itemId = do | 13 | putItemR itemId = do |