 (get-ip-address)
 
 
-(def store-session-app "https://script.google.com/a/macros/cam.ac.uk/s/AKfycbx1wfGXBMVImgmiyOY9JvcnV5tBNS8YyAlIiv73q4gjvkbRiis/exec")
+(def store-session-app "https://script.google.com/macros/s/AKfycbx1wfGXBMVImgmiyOY9JvcnV5tBNS8YyAlIiv73q4gjvkbRiis/exec"
+  )
 
 (def sheets-logger-app "https://script.google.com/a/macros/cam.ac.uk/s/AKfycbwg81jLTtCY_cU3qOVv6A93GePfnpAj-HxBM_7_nF8B-DkfyLp5/exec")
 


(defn load-session
  []
  (prn "load-session not yet implemented"))

(defn write-sheet-log
  "Write a log-event to the google sheet url."

  [response]
  (.log js/console (str response)))

(defn sheets-write-error
  [status status-text]
  (.log js/console (str "spreadsheet write error " status " " status-text)))

(defn sheets-read-error
  [status status-text]
  (.log js/console (str "spreadsheet read error " status " " status-text)))

(defn save-session
  "Write out a session to the store."
  []
  (POST store-session-app
        :params (str "ip=" @ip-address
                     "&saved-session=" (sit/write log-w @log-state))
        :handler sheets-success-handler
        :error-handler sheets-write-error
        :format {:write identity
                 :content-type "application/x-www-form-urlencoded"}
        :response-format :json
