mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-11 16:17:13 +00:00
* Implement possibility for async command handlers Command handler can now return results asynchronously, and those results as saved and persisted, indexed by command message-id. * Address feedback raised in PR comments * Different handler codes + simplified error message
17 lines
547 B
Clojure
17 lines
547 B
Clojure
(ns status-im.data-store.handler-data
|
|
(:require [cljs.reader :as reader]
|
|
[status-im.data-store.realm.handler-data :as data-store]
|
|
[taoensso.timbre :as log]))
|
|
|
|
(defn get-all []
|
|
(->> (data-store/get-all-as-list)
|
|
(map (fn [{:keys [message-id data]}]
|
|
[message-id (reader/read-string data)]))
|
|
(into {})))
|
|
|
|
(defn get-data [message-id]
|
|
(-> message-id data-store/get-by-message-id :data reader/read-string))
|
|
|
|
(defn save-data [handler-data]
|
|
(data-store/save (update handler-data :data pr-str)))
|