Skip to content

Instantly share code, notes, and snippets.

@tonysherbondy
Created June 27, 2018 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonysherbondy/b8cfc43e6f61a97126e1b19b0a034419 to your computer and use it in GitHub Desktop.
Save tonysherbondy/b8cfc43e6f61a97126e1b19b0a034419 to your computer and use it in GitHub Desktop.
Show motivating example for reg-obs
(db-utils/reg-obs
::obs-for-new-smart-boost
[[::routes/route]
[::working-boost]]
(fn [route working-boost]
(cond
(and (= (:handler route) :manage/content-two-new-smart-boost)
(not working-boost))
(rf/dispatch [::set-working-boost {:smart-boost-id (random-uuid)
:name "My SmartBoost"
:objective "BRAND_AWARENESS"
:end-time (.format (moment))
:budget {:type "lifetime"
:cents 10000}}])
(and (not= (:handler route) :manage/content-two-new-smart-boost)
working-boost)
(rf/dispatch [::set-working-boost nil]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment