             [domina.css :as css]
             [domina.xpath :as x]
             [eatme.client.render :as render]
-            [clojure.string :as string])
+            [clojure.string :as string]
+            [one.browser.history :as history])
   (:require-macros [shoreleave.remotes.macros :as srm]))
 
 (def query-args (common/query-args-map))
 (def hash-args (common/hash-args-map))
-
-;; Integrate history/back-button to the search
-;For example:
-;    (history/navigate-callback #(process-search (subs (:token %) 4) false))
-;Where process-search is the main action to take when processing the page/url
 
 ;; ### Browser REPL
 ;; If you add a `repl` as a query-string arg, even on the live site,

           :on-success (d/set-html! (d/by-id "userBaskets") (render/user-baskets baskets))
           :on-error (js/alert (str "Error loading user baskets"))))

(defn save-basket []
    (srm/rpc
     (api/save-basket (serialise-basket)) [response]
     :on-success (do (js/alert (str "Basket saved! Id: " (:id response)))
                     (basket-id (:id response)) (set-basket-saved!)
                     (load-user-baskets))
     :on-error (js/alert (str "Error saving basket"))))


(def item-added (pubsub/publishize
                 (fn [] {:item-name (d/value item-name-field)
                         :qty (to-int (d/value item-qty-field))}) bus))

(def item-deleted (pubsub/publishize (fn [e] {:item e}) bus))

(def quantity-changed (pubsub/publishize

                          :item e}) bus))

(def completed-item (pubsub/publishize (fn [e] {:item e}) bus))

(defn add-item-to-list [item]
  (when (and (< 0 (:qty item)) (not-empty (:item-name item)))
