diff options
Diffstat (limited to 'src/Main/Button.purs')
| -rw-r--r-- | src/Main/Button.purs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Main/Button.purs b/src/Main/Button.purs new file mode 100644 index 0000000..e05a0d8 --- /dev/null +++ b/src/Main/Button.purs @@ -0,0 +1,29 @@ +module Main.Button where + +import Prelude + +import Config as Config +import Data.HTTP.Method (Method(..)) +import Effect (Effect) +import Effect.Aff (Aff, launchAff_) +import Effect.Class (liftEffect) +import Effect.Console (log) +import Fetch (fetch) +import Utils (byId, listen) + +buttonPress :: String -> Aff Unit +buttonPress b = do + void $ fetch (Config.apiServer <> "/sentiment/" <> b) + { method: POST + } +main :: Effect Unit +main = launchAff_ do + liftEffect $ log "hello from button" + green <- byId "lcolonq-button-link-green" + listen green "click" \_ev -> do + liftEffect $ log "+2" + launchAff_ $ buttonPress "green" + red <- byId "lcolonq-button-link-red" + listen red "click" \_ev -> do + liftEffect $ log "-2" + launchAff_ $ buttonPress "red" |
