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>
<Button <Button
disabled={ disabled={
!job.converted || (job && !job.converted) ||
(selectedLines.length > 0 ? false : true) || (selectedLines.length > 0 ? false : true) ||
jobRO jobRO
} }

View File

@@ -1,9 +1,9 @@
import axios from "axios"; import axios from "axios";
import { all, call, put, select, takeLatest } from "redux-saga/effects"; import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
import { selectBodyshop } from "../user/user.selectors"; import { selectBodyshop } from "../user/user.selectors";
import { techLoginFailure, techLoginSuccess } from "./tech.actions"; import { techLoginFailure, techLoginSuccess } from "./tech.actions";
import TechActionTypes from "./tech.types"; import TechActionTypes from "./tech.types";
import { logImEXEvent } from "../../firebase/firebase.utils";
export function* onSignInStart() { export function* onSignInStart() {
yield takeLatest(TechActionTypes.TECH_LOGIN_START, signInStart); yield takeLatest(TechActionTypes.TECH_LOGIN_START, signInStart);
@@ -13,11 +13,20 @@ export function* signInStart({ payload: { employeeid, pin } }) {
logImEXEvent("redux_tech_sign_in"); logImEXEvent("redux_tech_sign_in");
const bodyshop = yield select(selectBodyshop); const bodyshop = yield select(selectBodyshop);
const response = yield call(axios.post, "/tech/login", { const response = yield call(
shopid: bodyshop.id, axios.post,
employeeid: employeeid, "/tech/login",
pin: pin, {
}); shopid: bodyshop.id,
employeeid: employeeid,
pin: pin,
},
{
headers: {
Authorization: `Bearer ${yield auth.currentUser.getIdToken()}`,
},
}
);
const { valid, technician, error } = response.data; const { valid, technician, error } = response.data;

View File

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