 ;; XXX: find a better place for all of the ajax functions, maybe a separate api
 ;;      namespace that knows about all of the api routes?
 (defmethod post-navigated-to! :project-settings
-  [history-imp to {:keys [project-name subpage]} previous-state current-state]
+  [history-imp navigation-point {:keys [project-name subpage]} previous-state current-state]
   (let [api-ch (get-in current-state [:comms :api])]
     (if (get-in current-state state/project-path)
       (mlog "project settings already loaded for" project-name)



(defmethod navigated-to :project-settings
  [history-imp to {:keys [project-name subpage org repo]} state]
  (-> state
      (assoc :navigation-point :project-settings)
      (assoc :navigation-data {}) ;; XXX: maybe put subpage info here?

;; --- Navigation Multimethod Declarations ---

(defmulti navigated-to
  (fn [history-imp navigation-point args state] navigation-point))

(defmulti post-navigated-to!
  (fn [history-imp navigation-point args previous-state current-state]
    (put! (get-in current-state [:comms :ws]) [:unsubscribe-stale-channels])
    navigation-point))

;; --- Navigation Mutlimethod Implementations ---

(defmethod navigated-to :default
  [history-imp navigation-point args state]
  (mlog "Unknown nav event: " (pr-str navigation-point))
  state)

(defmethod post-navigated-to! :default
  [history-imp navigation-point args previous-state current-state]
  (mlog "No post-nav for: " navigation-point))

(defmethod post-navigated-to! :navigate!
  [history-imp navigation-point path previous-state current-state]
  (let [path (if (= \/ (first path))
               (subs path 1)
               path)]
