MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / updateDataRequest

Function updateDataRequest

client/src/actions/dataRequest.js:76–107  ·  view source on GitHub ↗
(projectId, chartId, drId, data)

Source from the content-addressed store, hash-verified

74}
75
76export function updateDataRequest(projectId, chartId, drId, data) {
77 return (dispatch) => {
78 const token = cookie.load("brewToken");
79 const url = `${API_HOST}/project/${projectId}/chart/${chartId}/dataRequest/${drId}`;
80 const method = "PUT";
81 const body = JSON.stringify(data);
82 const headers = new Headers({
83 "Accept": "application/json",
84 "Content-Type": "application/json",
85 "Authorization": `Bearer ${token}`,
86 });
87
88 dispatch({ type: FETCHING_DATA_REQUEST });
89 return fetch(url, { method, body, headers })
90 .then((response) => {
91 if (!response.ok) {
92 dispatch(addError(response.status, "Could not update the Data Request"));
93 throw new Error(response.status);
94 }
95
96 return response.json();
97 })
98 .then((dataRequest) => {
99 dispatch({ type: FETCH_DATA_REQUEST_SUCCESS, dataRequest });
100 return Promise.resolve(dataRequest);
101 })
102 .catch((err) => {
103 dispatch({ type: FETCH_DATA_REQUEST_FAIL });
104 return Promise.reject(err);
105 });
106 };
107}
108
109export function deleteDataRequest(projectId, chartId, drId) {
110 return (dispatch) => {

Callers 2

_onSaveRequestFunction · 0.90
_onSaveRequestFunction · 0.85

Calls 2

addErrorFunction · 0.90
dispatchFunction · 0.50

Tested by

no test coverage detected