Resolve tech login issue.

This commit is contained in:
Patrick Fic
2021-01-08 10:32:05 -08:00
parent 7ca98094ea
commit 3ca416c5cf
3 changed files with 17 additions and 8 deletions

View File

@@ -323,7 +323,7 @@ export function JobLinesComponent({
</Button>
<Button
disabled={
!job.converted ||
(job && !job.converted) ||
(selectedLines.length > 0 ? false : true) ||
jobRO
}

View File

@@ -1,9 +1,9 @@
import axios from "axios";
import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
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);
@@ -13,11 +13,20 @@ export function* signInStart({ payload: { employeeid, pin } }) {
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,
});
const response = yield call(
axios.post,
"/tech/login",
{
shopid: bodyshop.id,
employeeid: employeeid,
pin: pin,
},
{
headers: {
Authorization: `Bearer ${yield auth.currentUser.getIdToken()}`,
},
}
);
const { valid, technician, error } = response.data;

View File

@@ -15,7 +15,7 @@ export const axiosAuthInterceptorId = axios.interceptors.request.use(
config.headers.Authorization = `Bearer ${token}`;
}
}
console.log("Axios interceptor called.");
return config;
},
(error) => Promise.reject(error)