parent
1321a85659
commit
dacc9a5446
|
@ -122,6 +122,12 @@
|
||||||
(assoc :new-contact-identity "")))
|
(assoc :new-contact-identity "")))
|
||||||
|
|
||||||
(register-handler :add-new-contact
|
(register-handler :add-new-contact
|
||||||
|
(u/side-effect!
|
||||||
|
(fn [_ [_ {:keys [whisper-identity] :as contact}]]
|
||||||
|
(when-not (contacts/get-contact whisper-identity)
|
||||||
|
(dispatch [::new-contact contact])))))
|
||||||
|
|
||||||
|
(register-handler ::new-contact
|
||||||
(-> add-new-contact
|
(-> add-new-contact
|
||||||
((after save-contact))
|
((after save-contact))
|
||||||
((after watch-contact))))
|
((after watch-contact))))
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
(r/sorted :name :asc)
|
(r/sorted :name :asc)
|
||||||
r/collection->map))
|
r/collection->map))
|
||||||
|
|
||||||
|
(defn get-contact [id]
|
||||||
|
(r/get-one-by-field :account :contact :whisper-identity id))
|
||||||
|
|
||||||
(defn create-contact [{:keys [whisper-identity] :as contact}]
|
(defn create-contact [{:keys [whisper-identity] :as contact}]
|
||||||
(let [contact-from-db (r/get-one-by-field :account :contact
|
(let [contact-from-db (r/get-one-by-field :account :contact
|
||||||
:whisper-identity whisper-identity)]
|
:whisper-identity whisper-identity)]
|
||||||
|
|
Loading…
Reference in New Issue