summaryrefslogtreecommitdiff
path: root/Miso/Extend.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-06-27 09:20:59 -0700
committerBen Sima <ben@bsima.me>2020-06-27 09:20:59 -0700
commit14e3c6a61f7727e994c4e1cf2568a3e606f84648 (patch)
tree6322dcfecf06bad2be8f85d560fd81e5206262e2 /Miso/Extend.hs
parent1ad6b3248f788cc178162bac5919c0b0fd6f9d39 (diff)
hero: implement the basics of user logins
There's also a lot of refactoring/renaming in here, so the diff is really messy. The overall problem is that I've only ever added code, I've never gone back and reorganized/rearchitected stuff. So adding even small features is becoming an enormous effort. Anyway, this adds the basics of user auth. Next I need to add the auth checks for every route that needs it, and make sure everything is back to working correctly.
Diffstat (limited to 'Miso/Extend.hs')
-rw-r--r--Miso/Extend.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Miso/Extend.hs b/Miso/Extend.hs
new file mode 100644
index 0000000..e7a9ff6
--- /dev/null
+++ b/Miso/Extend.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Miso.Extend
+ ( crossorigin_,
+ onPreventClick,
+ )
+where
+
+import Miso
+import Miso.String
+
+-- | HTML crossorigin attribute
+--
+-- https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin
+crossorigin_ :: MisoString -> Attribute action
+crossorigin_ = textProp "crossorigin"
+
+-- | Like 'onClick' but prevents the default action from triggering. Use this to
+-- overide 'a_' links, for example.
+onPreventClick :: action -> Attribute action
+onPreventClick action =
+ onWithOptions
+ Miso.defaultOptions {preventDefault = True}
+ "click"
+ emptyDecoder
+ (\() -> action)