(projectId, chartId)
| 201 | } |
| 202 | |
| 203 | export function removeChart(projectId, chartId) { |
| 204 | return (dispatch) => { |
| 205 | const token = cookie.load("brewToken"); |
| 206 | const url = `${API_HOST}/project/${projectId}/chart/${chartId}`; |
| 207 | const method = "DELETE"; |
| 208 | const headers = new Headers({ |
| 209 | "Accept": "application/json", |
| 210 | "authorization": `Bearer ${token}`, |
| 211 | }); |
| 212 | |
| 213 | dispatch({ type: FETCH_CHART }); |
| 214 | return fetch(url, { method, headers }) |
| 215 | .then((response) => { |
| 216 | if (!response.ok) { |
| 217 | dispatch(addError(response.status)); |
| 218 | return new Promise((resolve, reject) => reject(response.statusText)); |
| 219 | } |
| 220 | |
| 221 | return response.json(); |
| 222 | }) |
| 223 | .then((chart) => { |
| 224 | // dispatch({ type: FETCH_CHART_SUCCESS, chart }); |
| 225 | dispatch(getProjectCharts(projectId)); |
| 226 | return new Promise(resolve => resolve(chart)); |
| 227 | }) |
| 228 | .catch((error) => { |
| 229 | dispatch({ type: FETCH_CHART_FAIL }); |
| 230 | return new Promise((resolve, reject) => reject(error)); |
| 231 | }); |
| 232 | }; |
| 233 | } |
| 234 | |
| 235 | export function runQuery( |
| 236 | projectId, chartId, noSource = false, skipParsing = false, getCache, filters |
no test coverage detected