(projectId, chartId, drId)
| 107 | } |
| 108 | |
| 109 | export 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 | |
| 140 | export function runDataRequest(projectId, chartId, drId, getCache) { |
| 141 | return (dispatch) => { |
no test coverage detected