working page pagination controls

This commit is contained in:
Alexander Wong
2018-04-22 18:23:43 -06:00
parent dac6daa933
commit 0950f264e8
7 changed files with 153 additions and 39 deletions

View File

@@ -1,15 +1,9 @@
import { post } from "./baseApi";
import { get, post } from "./baseApi";
export function createCShifts(postBodies) {
const cShiftUrl = `/cshift/`;
// return Promise.all(
// postBodies.map(postBody => post(cShiftUrl, postBody).catch(() => false))
// ).then(postResponses => {
// Promise.resolve(postResponses);
// });
return Promise.all(
postBodies.map(postBody =>
post(cShiftUrl, postBody).catch(err => {
post("/cshift/", postBody).catch(err => {
return { error: true, ...err };
})
)
@@ -17,3 +11,7 @@ export function createCShifts(postBodies) {
return Promise.resolve(resp);
});
}
export function getCShifts(params) {
return get("/cshift/", params).then(resp => Promise.resolve(resp));
}