working page pagination controls
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
setFormShiftNote,
|
||||
setFormShiftStartTime
|
||||
} from "../actions/cShift/reducer.actions";
|
||||
import { createCShifts } from "../api/cShift.api";
|
||||
import { createCShifts, getCShifts } from "../api/cShift.api";
|
||||
|
||||
function* createCShiftsCall(postBodies) {
|
||||
yield effects.put(isSendingCShiftRequest(true));
|
||||
@@ -36,15 +36,25 @@ function* createCShiftsCall(postBodies) {
|
||||
}
|
||||
}
|
||||
|
||||
function* getCShiftsCall(params) {
|
||||
yield effects.put(isSendingCShiftRequest(true));
|
||||
try {
|
||||
return yield effects.call(getCShifts, params);
|
||||
} catch (exception) {
|
||||
yield effects.put(setCShiftRequestError(exception));
|
||||
return false;
|
||||
} finally {
|
||||
yield effects.put(isSendingCShiftRequest(false));
|
||||
}
|
||||
}
|
||||
|
||||
export function* createCShiftsFlow(request) {
|
||||
yield effects.put(clearCShiftRequestSuccess());
|
||||
yield effects.put(clearCShiftRequestError());
|
||||
const arrResponses = yield effects.call(createCShiftsCall, request.data);
|
||||
console.log(arrResponses);
|
||||
if (arrResponses) {
|
||||
const errorResps = arrResponses.filter(resp => !!resp.error);
|
||||
if (errorResps.length > 0) {
|
||||
console.log(arrResponses);
|
||||
yield effects.put(setCShiftRequestErrors(errorResps));
|
||||
}
|
||||
const succResps = arrResponses.filter(resp => !resp.error);
|
||||
@@ -59,3 +69,12 @@ export function* createCShiftsFlow(request) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function* getCShiftsFlow(request) {
|
||||
yield effects.put(clearCShiftRequestSuccess());
|
||||
yield effects.put(clearCShiftRequestError());
|
||||
const isSuccessful = yield effects.call(getCShiftsCall, request.data);
|
||||
if (isSuccessful) {
|
||||
yield effects.put(setCShiftRequestSuccess(isSuccessful));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user