MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / removeChart

Function removeChart

client/src/actions/chart.js:203–233  ·  view source on GitHub ↗
(projectId, chartId)

Source from the content-addressed store, hash-verified

201}
202
203export 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
235export function runQuery(
236 projectId, chartId, noSource = false, skipParsing = false, getCache, filters

Callers 2

_onDeleteChartFunction · 0.90
_onDeleteChartFunction · 0.90

Calls 3

addErrorFunction · 0.90
getProjectChartsFunction · 0.85
dispatchFunction · 0.50

Tested by

no test coverage detected