Added sentry logging.

This commit is contained in:
Patrick Fic
2021-02-24 12:27:08 -08:00
parent 7f02c130a2
commit 970fe5f9b7
5 changed files with 220 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import "firebase/auth";
import "firebase/database";
import "firebase/firestore";
import "firebase/messaging";
//import { store } from "../redux/store";
import { store } from "../redux/store";
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
firebase.initializeApp(config);
@@ -48,16 +48,17 @@ try {
export { messaging };
export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
// const state = stateProp || store.getState();
const state = stateProp || store.getState();
const eventParams = {
// shop:
// (state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
// null,
// user:
// (state.user && state.user.currentUser && state.user.currentUser.email) ||
// null,
shop:
(state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
null,
user:
(state.user && state.user.currentUser && state.user.currentUser.email) ||
null,
...additionalParams,
};
console.log("%c[Analytics]", "background: tomato", eventName, eventParams);
analytics.logEvent(eventName, eventParams);
};