30 lines
780 B
JavaScript
30 lines
780 B
JavaScript
import { get, put, post, del } from "./baseApi";
|
|
|
|
export function createCShifts(postBodies) {
|
|
return Promise.all(
|
|
postBodies.map(postBody =>
|
|
post("/cshift/", postBody).catch(err => {
|
|
return { error: true, ...err };
|
|
})
|
|
)
|
|
).then(resp => {
|
|
return Promise.resolve(resp);
|
|
});
|
|
}
|
|
|
|
export function getCShifts(params) {
|
|
return get("/cshift/", params).then(resp => Promise.resolve(resp));
|
|
}
|
|
|
|
export function getCShift(uuid, params) {
|
|
return get(`/cshift/${uuid}/`, params).then(resp => Promise.resolve(resp));
|
|
}
|
|
|
|
export function editCShift(uuid, payload) {
|
|
return put(`/cshift/${uuid}/`, payload).then(resp => Promise.resolve(resp));
|
|
}
|
|
|
|
export function deleteCShift(uuid) {
|
|
return del(`/cshift/${uuid}/`).then(resp => Promise.resolve(resp));
|
|
}
|