Added first round of analytics and event tracking BOD-190

This commit is contained in:
Patrick Fic
2020-07-17 08:27:28 -07:00
parent 3f0394760a
commit a54a85b96c
73 changed files with 433 additions and 208 deletions

View File

@@ -3,30 +3,25 @@ import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { selectBodyshop } from "../user/user.selectors";
import { techLoginFailure, techLoginSuccess } from "./tech.actions";
import TechActionTypes from "./tech.types";
import { logImEXEvent } from "../../firebase/firebase.utils";
export function* onSignInStart() {
yield takeLatest(TechActionTypes.TECH_LOGIN_START, signInStart);
}
export function* signInStart({ payload: { employeeid, pin } }) {
try {
logImEXEvent("redux_tech_sign_in");
const bodyshop = yield select(selectBodyshop);
const response = yield call(axios.post, "/tech/login", {
shopid: bodyshop.id,
employeeid: employeeid,
pin: pin,
});
console.log("response", response);
const { valid, technician, error } = response.data;
console.log(
"function*signInStart -> valid, technician, erro",
valid,
technician,
error
);
if (valid) {
console.log("Valid in else");
yield put(techLoginSuccess(technician));
} else {
yield put(techLoginFailure(error));