38 lines
788 B
Haskell
38 lines
788 B
Haskell
|
{-# LANGUAGE OverloadedStrings #-}
|
||
|
{-# LANGUAGE PackageImports #-}
|
||
|
module Control.Product where
|
||
|
|
||
|
import qualified Data.Text as T
|
||
|
|
||
|
-- 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 PruductPriceListPage
|
||
|
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
|