Framework for entering time tickets BOD-183 BOD-185
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import TechActionTypes from "./tech.types";
|
||||
const INITIAL_STATE = {
|
||||
technician: null,
|
||||
//technician: null,
|
||||
technician: {
|
||||
employee_number: "101",
|
||||
first_name: "***HARDCODED",
|
||||
last_name: "IN REDUCER***",
|
||||
},
|
||||
loginLoading: false,
|
||||
loginError: null,
|
||||
};
|
||||
|
||||
@@ -22,10 +22,12 @@ import {
|
||||
} from "./user.actions";
|
||||
import UserActionTypes from "./user.types";
|
||||
|
||||
export function* onEmailSignInStart() {
|
||||
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
||||
}
|
||||
export function* signInWithEmail({ payload: { email, password } }) {
|
||||
try {
|
||||
const { user } = yield auth.signInWithEmailAndPassword(email, password);
|
||||
LogRocket.identify(user.email);
|
||||
|
||||
yield put(
|
||||
signInSuccess({
|
||||
@@ -40,9 +42,9 @@ export function* signInWithEmail({ payload: { email, password } }) {
|
||||
yield put(signInFailure(error));
|
||||
}
|
||||
}
|
||||
//This is the listener fo rthe call, and when it finds it, it triggers somethign else.
|
||||
export function* onEmailSignInStart() {
|
||||
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
||||
|
||||
export function* onCheckUserSession() {
|
||||
yield takeLatest(UserActionTypes.CHECK_USER_SESSION, isUserAuthenticated);
|
||||
}
|
||||
export function* isUserAuthenticated() {
|
||||
try {
|
||||
@@ -66,8 +68,9 @@ export function* isUserAuthenticated() {
|
||||
yield put(signInFailure(error));
|
||||
}
|
||||
}
|
||||
export function* onCheckUserSession() {
|
||||
yield takeLatest(UserActionTypes.CHECK_USER_SESSION, isUserAuthenticated);
|
||||
|
||||
export function* onSignOutStart() {
|
||||
yield takeLatest(UserActionTypes.SIGN_OUT_START, signOutStart);
|
||||
}
|
||||
export function* signOutStart() {
|
||||
try {
|
||||
@@ -78,9 +81,7 @@ export function* signOutStart() {
|
||||
yield put(signOutFailure(error.message));
|
||||
}
|
||||
}
|
||||
export function* onSignOutStart() {
|
||||
yield takeLatest(UserActionTypes.SIGN_OUT_START, signOutStart);
|
||||
}
|
||||
|
||||
export function* onUpdateUserDetails() {
|
||||
yield takeLatest(UserActionTypes.UPDATE_USER_DETAILS, updateUserDetails);
|
||||
}
|
||||
@@ -140,7 +141,7 @@ export function* checkInstanceIdSaga({ payload: uid }) {
|
||||
} catch (error) {
|
||||
console.log("error", error);
|
||||
//TODO error handling
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function* onSignInSuccess() {
|
||||
@@ -148,6 +149,7 @@ export function* onSignInSuccess() {
|
||||
}
|
||||
|
||||
export function* signInSuccessSaga({ payload }) {
|
||||
LogRocket.identify(user.email);
|
||||
yield put(setInstanceId(payload.uid));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user