Reformat all project files to use the prettier config file.

This commit is contained in:
Patrick Fic
2024-03-27 15:35:07 -07:00
parent b161530381
commit e1df64d592
873 changed files with 111387 additions and 125473 deletions

View File

@@ -1,20 +1,20 @@
import TechActionTypes from "./tech.types";
export const techLoginStart = ({employeeid, pin}) => ({
type: TechActionTypes.TECH_LOGIN_START,
payload: {employeeid, pin},
export const techLoginStart = ({ employeeid, pin }) => ({
type: TechActionTypes.TECH_LOGIN_START,
payload: { employeeid, pin }
});
export const techLoginSuccess = (tech) => ({
type: TechActionTypes.TECH_LOGIN_SUCCESS,
payload: tech,
type: TechActionTypes.TECH_LOGIN_SUCCESS,
payload: tech
});
export const techLoginFailure = (error) => ({
type: TechActionTypes.TECH_LOGIN_FAILURE,
payload: error,
type: TechActionTypes.TECH_LOGIN_FAILURE,
payload: error
});
export const techLogout = () => ({
type: TechActionTypes.TECH_LOGOUT,
type: TechActionTypes.TECH_LOGOUT
});

View File

@@ -1,46 +1,46 @@
import TechActionTypes from "./tech.types";
const INITIAL_STATE = {
technician: null,
// technician: {
// employee_number: "101",
// first_name: "***HARDCODED",
// last_name: "IN REDUCER***",
// },
loginLoading: false,
loginError: null,
technician: null,
// technician: {
// employee_number: "101",
// first_name: "***HARDCODED",
// last_name: "IN REDUCER***",
// },
loginLoading: false,
loginError: null
};
const applicationReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case TechActionTypes.TECH_LOGOUT:
return {
...state,
technician: null,
loginError: null,
};
case TechActionTypes.TECH_LOGIN_START:
return {
...state,
loginLoading: true,
};
case TechActionTypes.TECH_LOGIN_SUCCESS:
return {
...state,
technician: action.payload,
loginLoading: false,
loginError: false,
};
case TechActionTypes.TECH_LOGIN_FAILURE:
return {
...state,
loginError: action.payload,
loginLoading: false,
};
switch (action.type) {
case TechActionTypes.TECH_LOGOUT:
return {
...state,
technician: null,
loginError: null
};
case TechActionTypes.TECH_LOGIN_START:
return {
...state,
loginLoading: true
};
case TechActionTypes.TECH_LOGIN_SUCCESS:
return {
...state,
technician: action.payload,
loginLoading: false,
loginError: false
};
case TechActionTypes.TECH_LOGIN_FAILURE:
return {
...state,
loginError: action.payload,
loginLoading: false
};
default:
return state;
}
default:
return state;
}
};
export default applicationReducer;

View File

@@ -1,37 +1,37 @@
import axios from "axios";
import {all, call, put, select, takeLatest} from "redux-saga/effects";
import {logImEXEvent} from "../../firebase/firebase.utils";
import {selectBodyshop} from "../user/user.selectors";
import {techLoginFailure, techLoginSuccess} from "./tech.actions";
import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { selectBodyshop } from "../user/user.selectors";
import { techLoginFailure, techLoginSuccess } from "./tech.actions";
import TechActionTypes from "./tech.types";
export function* onSignInStart() {
yield takeLatest(TechActionTypes.TECH_LOGIN_START, signInStart);
yield takeLatest(TechActionTypes.TECH_LOGIN_START, signInStart);
}
export function* signInStart({payload: {employeeid, pin}}) {
try {
logImEXEvent("redux_tech_sign_in");
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,
});
const bodyshop = yield select(selectBodyshop);
const response = yield call(axios.post, "/tech/login", {
shopid: bodyshop.id,
employeeid: employeeid,
pin: pin
});
const {valid, technician, error} = response.data;
const { valid, technician, error } = response.data;
if (valid) {
yield put(techLoginSuccess(technician));
} else {
yield put(techLoginFailure(error));
}
} catch (error) {
yield put(techLoginFailure(error));
if (valid) {
yield put(techLoginSuccess(technician));
} else {
yield put(techLoginFailure(error));
}
} catch (error) {
yield put(techLoginFailure(error));
}
}
export function* techSagas() {
yield all([call(onSignInStart)]);
yield all([call(onSignInStart)]);
}

View File

@@ -1,16 +1,7 @@
import {createSelector} from "reselect";
import { createSelector } from "reselect";
const selectTechReducer = (state) => state.tech;
export const selectTechnician = createSelector(
[selectTechReducer],
(application) => application.technician
);
export const selectLoginError = createSelector(
[selectTechReducer],
(application) => application.loginError
);
export const selectLoginLoading = createSelector(
[selectTechReducer],
(application) => application.loginLoading
);
export const selectTechnician = createSelector([selectTechReducer], (application) => application.technician);
export const selectLoginError = createSelector([selectTechReducer], (application) => application.loginError);
export const selectLoginLoading = createSelector([selectTechReducer], (application) => application.loginLoading);

View File

@@ -1,7 +1,7 @@
const TechActionTypes = {
TECH_LOGIN_START: "TECH_LOGIN_START",
TECH_LOGIN_SUCCESS: "TECH_LOGIN_SUCCESS",
TECH_LOGIN_FAILURE: "TECH_LOGIN_FAILURE",
TECH_LOGOUT: "TECH_LOGOUT",
TECH_LOGIN_START: "TECH_LOGIN_START",
TECH_LOGIN_SUCCESS: "TECH_LOGIN_SUCCESS",
TECH_LOGIN_FAILURE: "TECH_LOGIN_FAILURE",
TECH_LOGOUT: "TECH_LOGOUT"
};
export default TechActionTypes;