{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} module Main where import Data.Text import Data.Time import System.Locale import Test.Hspec import Yesod hiding (Key, get) import Yesod.Form.Jquery (YesodJquery (..)) import Yesod.Test import Yesod.Transloadit data Test = Test mkYesod "Test" [parseRoutes| / HomeR GET |] instance Yesod Test instance YesodJquery Test instance YesodTransloadit Test instance RenderMessage Test FormMessage where renderMessage _ _ = defaultFormMessage getHomeR :: Handler Html getHomeR = defaultLayout $ do let now = UTCTime (ModifiedJulianDay 50000) (secondsToDiffTime 10) -- Create an id for your form ident <- newIdent -- Create some Transloadit params, you need: Expiry time; Api key; Template Id; Form id let expiry = addUTCTime 3600 now key = Key "my_key" template = Template "my_template" secret = Secret "my_secret" params = mkParams expiry key template ident secret -- Load the widget, and retrieve the given signature sig <- either (const $ error "nooo") transloadIt params -- CSRF considerations t <- tokenText -- Create a form [whamlet|