Open oliyh opened 2 years ago
Even better, It would be nice if it was able to add any arguments to the callback. Kinda like currying the event
(re-frame/reg-event-db
::on-thing
[re-frame/unwrap]
(fn [db [user-id user {:keys [response]}]]
(let [{:keys [data errors]} response]
;; do things with data e.g. write it into the re-frame database
)))
(re-frame/dispatch [::re-graph/subscribe
{:id :my-subscription-id
:query "{ things { id } }"
:variables {:some "variable"}
:callback [::on-thing 10 {:username "user" :role "admin"}]}])
What do you think? This would unfortunately break the current functionality, but I think it's a nice addition.
It's now given a map with
:response
key populated, but it might be nice if it also had:id
,:query
,:variables
etc as well, this could potentially save the user piping this stuff around if they need it in the callback handler