This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; There are three parts to the problem: | |
;; (1) putting the token on the page on the server-side, | |
;; (2) getting it off on the client-side, | |
;; (3) and then POST-ing it with the request. | |
;;;; One could also GET and then POST using a route, but that makes the CSRF token useless. | |
; 1. Putting the token on the page. | |
; handler.clj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.Eff (Eff) | |
import Data.Maybe (fromJust) | |
import Data.Tuple (Tuple(..)) | |
import Graphics.Canvas (CANVAS, Context2D, closePath, getCanvasElementById, | |
getContext2D, lineTo, moveTo, setLineWidth, strokePath) | |
import Math (cos, pi, sin) | |
import Partial.Unsafe (unsafePartial) | |
import Prelude (Unit, bind, discard, negate, void, ($), (*), (+), (-), (/), (<=)) |