{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PackageImports #-} module Control.Product where import Servant import Servant.Client import Data.String (fromString) import qualified Data.Text as T import Control.Monad.IO.Class (liftIO) -- imports from "mateamt" import qualified "mateamt" Types as MT -- internal imports import Types import View import Util import Client import ClientAuth import API import Hash productGetPriceList :: Maybe T.Text -> UserHandler ProductPriceListPage productGetPriceList mcookie = do (token, muser, loc, l10n, backend) <- controlInit mcookie elist <- liftIO $ runClientM (productShortList (Just MT.AllProducts) ) backend case elist of Right list -> return (productPriceListPage l10n loc mcookie list) Left err -> throwError $ addMessage (fromString $ show err) $ redirect303 userSelectLink