fix(deletion): fix usage of deleteR from POST handler

This commit is contained in:
Gregor Kleen 2020-07-20 14:17:14 +02:00
parent febf316c6c
commit c87c9c13d1

View File

@ -68,12 +68,12 @@ confirmFormReduced :: Monad m => AForm m Bool
confirmFormReduced = pure True
confirmForm' :: PersistEntity record => Set (Key record) -> Text -> Maybe Message -> Form Bool
confirmForm' drRecords confirmString mmsg = addDeleteTargets . identifyForm FIDDelete . renderAForm FormStandard . maybe id ((*>) . aformMessage) mmsg . maybe confirmFormReduced confirmForm $ assertM' (not . Text.null . Text.strip) confirmString
confirmForm' drRecords confirmString mmsg = identifyForm FIDDelete . addDeleteTargets . renderAForm FormStandard . maybe id ((*>) . aformMessage) mmsg . maybe confirmFormReduced confirmForm $ assertM' (not . Text.null . Text.strip) confirmString
where
addDeleteTargets :: Form a -> Form a
addDeleteTargets form csrf = do
(_, fvTargets) <- mreq secretJsonField ("" & addName (toPathPiece PostDeleteTarget)) (Just drRecords)
over _2 (mappend $ fvWidget fvTargets) <$> form csrf
over _2 (mappend $ fvInput fvTargets) <$> form csrf
postDeleteR :: ( DeleteCascade record SqlBackend )