Browse Source

enhance: check instrument payload

rcmerci 2 years ago
parent
commit
ed972ccd8d
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/main/frontend/handler/events.cljs

+ 3 - 1
src/main/frontend/handler/events.cljs

@@ -403,7 +403,9 @@
 (defmethod handle :redirect-to-home [_]
   (page-handler/create-today-journal!))
 
-(defmethod handle :instrument [[_ {:keys [type payload]}]]
+(defmethod handle :instrument [[_ {:keys [type payload] :as opts}]]
+  (when-not (empty? (dissoc opts :type :payload))
+    (js/console.error "instrument data-map should only contains [:type :payload]"))
   (posthog/capture type payload))
 
 (defmethod handle :exec-plugin-cmd [[_ {:keys [pid cmd action]}]]