diff --git a/superset/assets/src/dashboard/actions/dashboardState.js b/superset/assets/src/dashboard/actions/dashboardState.js index 883a508c0faaa..2ff139fcdb714 100644 --- a/superset/assets/src/dashboard/actions/dashboardState.js +++ b/superset/assets/src/dashboard/actions/dashboardState.js @@ -132,16 +132,14 @@ export function saveDashboardRequest(data, id, saveType) { SupersetClient.post({ endpoint: `/superset/${path}/${id}/`, postPayload: { data }, - parseMethod: null, }) .then(response => Promise.all([ - Promise.resolve(response), dispatch(saveDashboardRequestSuccess()), dispatch( addSuccessToast(t('This dashboard was saved successfully.')), ), - ]), + ]).then(() => Promise.resolve(response)), ) .catch(response => getClientErrorObject(response).then(({ error }) => diff --git a/superset/assets/src/dashboard/actions/sliceEntities.js b/superset/assets/src/dashboard/actions/sliceEntities.js index 33e3507c1a69f..31a03db0d23d2 100644 --- a/superset/assets/src/dashboard/actions/sliceEntities.js +++ b/superset/assets/src/dashboard/actions/sliceEntities.js @@ -3,7 +3,10 @@ import { SupersetClient } from '@superset-ui/core'; import { addDangerToast } from '../../messageToasts/actions'; import { t } from '../../locales'; -import { getDatasourceParameter } from '../../modules/utils'; +import { + getDatasourceParameter, + getClientErrorObject, +} from '../../modules/utils'; export const SET_ALL_SLICES = 'SET_ALL_SLICES'; export function setAllSlices(slices) { @@ -64,22 +67,19 @@ export function fetchAllSlices(userId) { return dispatch(setAllSlices(slices)); }) - .catch(error => - Promise.all([ + .catch(errorResponse => + getClientErrorObject(errorResponse).then(({ error }) => { dispatch( fetchAllSlicesFailed( - error.error || - error.statusText || - t('Could not fetch all saved charts'), + error || t('Could not fetch all saved charts'), ), - ), + ); dispatch( addDangerToast( - t('Sorry there was an error fetching saved charts: ') + - error.error || error.statusText, + t('Sorry there was an error fetching saved charts: ') + error, ), - ), - ]), + ); + }), ); } diff --git a/superset/assets/src/dashboard/components/SaveModal.jsx b/superset/assets/src/dashboard/components/SaveModal.jsx index 13863a24c259d..2e3d94973f895 100644 --- a/superset/assets/src/dashboard/components/SaveModal.jsx +++ b/superset/assets/src/dashboard/components/SaveModal.jsx @@ -93,7 +93,7 @@ class SaveModal extends React.PureComponent { t('You must pick a name for the new dashboard'), ); } else { - this.onSave(data, dashboardId, saveType).then(([resp]) => { + this.onSave(data, dashboardId, saveType).then(resp => { if ( saveType === SAVE_TYPE_NEWDASHBOARD && resp &&