 (register-handler
   :state-show-thread
   (fn [app-state [_ show?]]
-    (if (not show?) (dispatch [:state-browser-token :remember]))
     (assoc-in app-state [:ui-state :show-thread?] show?)))
 
 

(register-handler
  :memory-forget-success
  (fn [app-state [_ msg]]
    (.log js/console (get-in app-state [:ui-state :section]))
    (dispatch [:state-message (str "Thought forgotten") "alert-success"])
    (if (= :remember (get-in app-state [:ui-state :section])) ; Just in case we allow editing from elsewhere...
      (dispatch [:memories-load]))
    (-> app-state
        (assoc-in [:ui-state :is-busy?] false)
        (assoc-in [:note :edit-memory] nil)
        (assoc-in [:note :edit-note] "")
        (assoc-in [:note :focus] nil)
        (assoc :search-state nil)
        )))

(register-handler
  :memory-forget-error

  :memory-forget
  (fn [app-state [_ root-id]]
    (let [url (str "/api/memory/" root-id "/thought")]
      (DELETE url {:headers       {:authorization (str "Token " (get-in app-state [:credentials :token]))}
                   :handler       #(dispatch [:memory-forget-success %])
                   :error-handler #(dispatch [:memory-forget-error %])}))
