added parts for last 3 calls
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import {
|
||||
timeTicketCreateFailure,
|
||||
timeTicketCreateSuccess,
|
||||
timeTicketClockInSuccess,
|
||||
timeTicketClockInFailure,
|
||||
timeTicketClockOutSuccess,
|
||||
timeTicketClockOutFailure
|
||||
} from "./timetickets.actions";
|
||||
import TimeTicketsActionTypes from "./timetickets.types";
|
||||
import { client } from "../../graphql/client";
|
||||
@@ -67,6 +71,69 @@ export function* insertNewTimeTicket({ payload: { timeTicketInput } }) {
|
||||
}
|
||||
}
|
||||
|
||||
export function* timeTicketsSagas() {
|
||||
yield all([call(onCreateTimeTicketStart)]);
|
||||
export function* onClockOutStart() {
|
||||
yield takeLatest(TimeTicketsActionTypes.TIME_TICKET_CLOCKOUT_START,clockOutStart);
|
||||
}
|
||||
export function* clockOutStart({ payload: { timeTicketInput } }) {
|
||||
try {
|
||||
logImEXEvent("redux_clockOutStart_attempt");
|
||||
//console.loging
|
||||
console.log("Saga, clockOutStart :", timeTicketInput);
|
||||
// const timeTicket = yield select(selectCurrentTimeTicket);
|
||||
// const response = yield call(axios.post, "/tech/login", {
|
||||
// shopid: bodyshop.id,
|
||||
// employeeid: employeeId,
|
||||
// pin: pin,
|
||||
// });
|
||||
// const { valid, data, error } = response.data;
|
||||
// const result = yield client.mutate({
|
||||
// mutation: INSERT_NEW_TIME_TICKET,
|
||||
// variables: {
|
||||
// timeTicketInput: [
|
||||
// // {
|
||||
// // bodyshopid: bodyshop.id,
|
||||
// // employeeid: technician.id,
|
||||
// // date: moment(theTime).format("YYYY-MM-DD"),
|
||||
// // clockon: moment(theTime),
|
||||
// // jobid: values.jobid,
|
||||
// // cost_center: values.cost_center,
|
||||
// // ciecacode:
|
||||
// // bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||
// // ? values.cost_center
|
||||
// // : Object.keys(
|
||||
// // bodyshop.md_responsibility_centers.defaults.costs
|
||||
// // ).find((key) => {
|
||||
// // return (
|
||||
// // bodyshop.md_responsibility_centers.defaults.costs[key] ===
|
||||
// // values.cost_center
|
||||
// // );
|
||||
// // }),
|
||||
// // },
|
||||
// ],
|
||||
// },
|
||||
// });
|
||||
// console.log(result);
|
||||
// const { valid, data, error } = result.data;
|
||||
// if (valid) {
|
||||
// yield put(timeTicketCreateSuccess(data));
|
||||
// } else {
|
||||
// yield put(timeTicketCreateFailure(error));
|
||||
// }
|
||||
} catch (error) {
|
||||
yield put(timeTicketClockOutFailure(error));
|
||||
}
|
||||
}
|
||||
export function* onClockInStart() {
|
||||
yield takeLatest(TimeTicketsActionTypes.TIME_TICKET_CLOCKIN_START,clockInStart);
|
||||
}
|
||||
export function* clockInStart({ payload: { timeTicketInput } }) {
|
||||
try {
|
||||
logImEXEvent("redux_clockInStart_attempt");
|
||||
console.log("Saga, clockInStart :", timeTicketInput);
|
||||
} catch (error) {
|
||||
yield put(timeTicketClockInFailure(error));
|
||||
}
|
||||
}
|
||||
export function* timeTicketsSagas() {
|
||||
yield all([call(onCreateTimeTicketStart),call(onClockOutStart),call(onClockInStart)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user