fix update stage
This commit is contained in:
parent
ca6e0be255
commit
a858cd07c1
@ -1,45 +1,91 @@
|
|||||||
import api from './client';
|
import api from "./client";
|
||||||
|
|
||||||
export const StagesApi = {
|
export const StagesApi = {
|
||||||
createStage(formId, payload) {
|
createStage(formId, payload) {
|
||||||
return api.post(`/stages/form/${formId}`, payload).then((r) => r.data);
|
return api.post(`/stages/form/${formId}`, payload).then((r) => r.data);
|
||||||
},
|
},
|
||||||
updateStage(payload) {
|
updateStage(payload) {
|
||||||
const { budget_form_id, sheet, phase_code } = payload;
|
const { budget_form_id, sheet, phase_code, direction } = payload;
|
||||||
|
if (direction) {
|
||||||
|
return api
|
||||||
|
.patch(
|
||||||
|
`/stages/form/${budget_form_id}/${sheet}/${phase_code}/?direction=${direction}`,
|
||||||
|
payload,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
|
}
|
||||||
|
|
||||||
return api.patch(`/stages/form/${budget_form_id}/${sheet}/${phase_code}`, payload).then((r) => r.data);
|
return api
|
||||||
|
.patch(`/stages/form/${budget_form_id}/${sheet}/${phase_code}`, payload)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
deleteStage(formId, sheet, phaseCode) {
|
deleteStage(formId, sheet, phaseCode) {
|
||||||
return api.delete(`/stages/form/${formId}/${sheet}/${phaseCode}`).then((r) => r.data);
|
return api
|
||||||
|
.delete(`/stages/form/${formId}/${sheet}/${phaseCode}`)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
getStages(formId) {
|
getStages(formId) {
|
||||||
return api.get(`/stages/form/${formId}`).then((r) => r.data);
|
return api.get(`/stages/form/${formId}`).then((r) => r.data);
|
||||||
},
|
},
|
||||||
createStageAccessHeader(tableId, stageId, payload) {
|
createStageAccessHeader(tableId, stageId, payload) {
|
||||||
return api.post(`/table-data/templates/templates/${tableId}/stages/${stageId}/access_headers/`, payload).then((r) => r.data);
|
return api
|
||||||
|
.post(
|
||||||
|
`/table-data/templates/templates/${tableId}/stages/${stageId}/access_headers/`,
|
||||||
|
payload,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
createStageAccessCell(tableId, stageId, payload) {
|
createStageAccessCell(tableId, stageId, payload) {
|
||||||
return api.post(`/table-data/templates/templates/${tableId}/stages/${stageId}/access_cells/`, payload).then((r) => r.data);
|
return api
|
||||||
|
.post(
|
||||||
|
`/table-data/templates/templates/${tableId}/stages/${stageId}/access_cells/`,
|
||||||
|
payload,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
updateStageAccessHeader(tableId, stageId, payload) {
|
updateStageAccessHeader(tableId, stageId, payload) {
|
||||||
return api
|
return api
|
||||||
.put(`/table-data/templates/templates/${tableId}/stages/${stageId}/access_headers/${payload.id}/`, payload)
|
.put(
|
||||||
|
`/table-data/templates/templates/${tableId}/stages/${stageId}/access_headers/${payload.id}/`,
|
||||||
|
payload,
|
||||||
|
)
|
||||||
.then((r) => r.data);
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
updateStageAccessCell(tableId, stageId, payload) {
|
updateStageAccessCell(tableId, stageId, payload) {
|
||||||
return api.put(`/table-data/templates/templates/${tableId}/stages/${stageId}/access_cells/${payload.id}/`, payload).then((r) => r.data);
|
return api
|
||||||
|
.put(
|
||||||
|
`/table-data/templates/templates/${tableId}/stages/${stageId}/access_cells/${payload.id}/`,
|
||||||
|
payload,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
deleteStageAccessHeader(tableId, stageId, accessHeaderId) {
|
deleteStageAccessHeader(tableId, stageId, accessHeaderId) {
|
||||||
return api.delete(`/table-data/templates/templates/${tableId}/stages/${stageId}/access_headers/${accessHeaderId}/`).then((r) => r.data);
|
return api
|
||||||
|
.delete(
|
||||||
|
`/table-data/templates/templates/${tableId}/stages/${stageId}/access_headers/${accessHeaderId}/`,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
getStageAccessHeader(template_id, stage_id) {
|
getStageAccessHeader(template_id, stage_id) {
|
||||||
return api.get(`/table-data/templates/templates/${template_id}/stages/${stage_id}/access_headers/`).then((r) => r.data);
|
return api
|
||||||
|
.get(
|
||||||
|
`/table-data/templates/templates/${template_id}/stages/${stage_id}/access_headers/`,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
getStageAccessCell(template_id, stage_id) {
|
getStageAccessCell(template_id, stage_id) {
|
||||||
return api.get(`/table-data/templates/templates/${template_id}/stages/${stage_id}/access_cells/`).then((r) => r.data);
|
return api
|
||||||
|
.get(
|
||||||
|
`/table-data/templates/templates/${template_id}/stages/${stage_id}/access_cells/`,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
deleteStageAccessCell(tableId, stageId, accessCellId) {
|
deleteStageAccessCell(tableId, stageId, accessCellId) {
|
||||||
return api.delete(`/table-data/templates/templates/${tableId}/stages/${stageId}/access_cells/${accessCellId}/`).then((r) => r.data);
|
return api
|
||||||
|
.delete(
|
||||||
|
`/table-data/templates/templates/${tableId}/stages/${stageId}/access_cells/${accessCellId}/`,
|
||||||
|
)
|
||||||
|
.then((r) => r.data);
|
||||||
},
|
},
|
||||||
getStagesForTask(taskId) {
|
getStagesForTask(taskId) {
|
||||||
return api.get(`/tasks/${taskId}/stages`).then((r) => r.data);
|
return api.get(`/tasks/${taskId}/stages`).then((r) => r.data);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user