 (ns battle-console.game
   (:require [battle-console.state :as state]
-            [ajax.core :refer [GET POST]]
+            [ajax.core :refer [GET POST, PUT]]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
             [cljs.reader :as reader]

  (let [token (state/get-state :token)
        url (str "http://api.orionsbelt.eu/game/" (params :id) "?token=" token)]
    (state/set-state :loading-game (str "Loading game " (params :id) "..."))
    (GET url {:handler game-loaded
              :error-handler error-loading})))


(defn- get-stash
  "Gets the current stash"
  [game]
  (get-in game ["battle" "stash" (get-in game ["viewed-by" "player-code"])]))

(defn- game-stash
  "Shows the current stash if available"
