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

Function deleteDataRequest

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

Source from the content-addressed store, hash-verified

107}
108
109export function deleteDataRequest(projectId, chartId, drId) {
110 return (dispatch) => {
111 const token = cookie.load("brewToken");
112 const url = `${API_HOST}/project/${projectId}/chart/${chartId}/dataRequest/${drId}`;
113 const method = "DELETE";
114 const headers = new Headers({
115 "Accept": "application/json",
116 "Authorization": `Bearer ${token}`,
117 });
118
119 dispatch({ type: FETCHING_DATA_REQUEST });
120 return fetch(url, { method, headers })
121 .then((response) => {
122 if (!response.ok) {
123 dispatch(addError(response.status, "Could not delete the Data Request"));
124 throw new Error(response.status);
125 }
126
127 return response.json();
128 })
129 .then((dataRequest) => {
130 dispatch({ type: DATA_REQUEST_DELETED, id: drId });
131 return dataRequest;
132 })
133 .catch((err) => {
134 dispatch({ type: FETCH_DATA_REQUEST_FAIL });
135 return Promise.reject(err);
136 });
137 };
138}
139
140export function runDataRequest(projectId, chartId, drId, getCache) {
141 return (dispatch) => {

Callers 2

_onDeleteRequestFunction · 0.90
_onDeleteRequestFunction · 0.85

Calls 2

addErrorFunction · 0.90
dispatchFunction · 0.50

Tested by

no test coverage detected