From 14e3c6a61f7727e994c4e1cf2568a3e606f84648 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 27 Jun 2020 09:20:59 -0700 Subject: 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. --- Miso/Extend.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Miso/Extend.hs (limited to 'Miso') 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) -- cgit v1.2.3