[Explore view] Use POST method for charting requests (#3993)

* [Explore view] Use POST method for charting requests

* fix per code review comments

* more code review fixes

* code review fix: remove duplicated calls for getting values from request

* [Explore view] Use POST method for charting requests

* fix per code review comments

* more code review fixes

* code review fix: remove duplicated calls for getting values from request
This commit is contained in:
Grace Guo
2018-02-13 17:21:15 -08:00
committed by GitHub
parent d2d973153f
commit 342180b263
29 changed files with 478 additions and 211 deletions

View File

@@ -1,3 +1,5 @@
import { getExploreUrlAndPayload } from '../exploreUtils';
const $ = window.$ = require('jquery');
export const FETCH_DASHBOARDS_SUCCEEDED = 'FETCH_DASHBOARDS_SUCCEEDED';
@@ -44,14 +46,27 @@ export function removeSaveModalAlert() {
return { type: REMOVE_SAVE_MODAL_ALERT };
}
export function saveSlice(url) {
return function (dispatch) {
return $.get(url, (data, status) => {
if (status === 'success') {
export function saveSlice(formData, requestParams) {
return (dispatch) => {
const { url, payload } = getExploreUrlAndPayload({
formData,
endpointType: 'base',
force: false,
curUrl: null,
requestParams,
});
return $.ajax({
type: 'POST',
url,
data: {
form_data: JSON.stringify(payload),
},
success: ((data) => {
dispatch(saveSliceSuccess(data));
} else {
}),
error: (() => {
dispatch(saveSliceFailed());
}
}),
});
};
}