update pair request alert when button is pressed
This commit is contained in:
parent
f62cc48482
commit
1e41c0d85e
7 changed files with 54 additions and 18 deletions
|
@ -76,4 +76,19 @@ getSideBarR nid = do
|
|||
getCloseAlert :: AlertId -> Handler ()
|
||||
getCloseAlert i = do
|
||||
webapp <- getYesod
|
||||
void $ liftIO $ removeAlert (daemonStatus webapp) i
|
||||
liftIO $ removeAlert (daemonStatus webapp) i
|
||||
|
||||
{- When an alert with a button is clicked on, the button takes us here. -}
|
||||
getClickAlert :: AlertId -> Handler ()
|
||||
getClickAlert i = do
|
||||
webapp <- getYesod
|
||||
m <- alertMap <$> liftIO (getDaemonStatus $ daemonStatus webapp)
|
||||
case M.lookup i m of
|
||||
Just (Alert { alertButton = Just b }) -> do
|
||||
{- Spawn a thread to run the action while redirecting. -}
|
||||
case buttonAction b of
|
||||
Nothing -> noop
|
||||
Just a -> liftIO $ void $ forkIO $ a i
|
||||
redirect $ buttonUrl b
|
||||
_ -> redirectBack
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue