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
import Cookies from 'universal-cookie' | |
// Get Django cross site request forgery cookie for API requests. | |
const getCSRF = () => new Cookies().get('csrftoken') | |
// HTTP helper functions. | |
const http = { | |
// POST a JSON to URL (create new resource) | |
post: (url, data) => | |
fetch(url, { |
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
(defn create-function-call [param expr] | |
"Create an sexp for calling expr with a first argument provided by a promise. | |
If expr is a list (already in form suitable for a function call), insert the first argument at second position, | |
otherwise turn expr into a function call expression, unless the function is an fn, which is simply returned. | |
println -> (fn [param] (println param)) | |
(* 2) -> (fn [param] (* param 2)) | |