浏览代码

enhance: check instrument payload

rcmerci 2 年之前
父节点
当前提交
ed972ccd8d
共有 1 个文件被更改,包括 3 次插入1 次删除
  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]}]]