mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
* API call to create queries * Add queries to redux * create query when query form is submitted * Redirect to ShowQueryPage after creating query * Removes theme dropdown and NewQuery component header * Extract NewQueryPage component state to redux state * Pass logic down to NewQuery component as props * Changes NewQuery component name to QueryComposer * Render NewQueryPage for /queries/:id route * Update ReduxConfig for loading a single resource * QueryPage tests * Get query when the query page loads * catch errors when query is invalid * Renames UpdateQueryForm to QueryForm to re-usability * Changes InputField to a controlled component * Always render the Query Form on Query Pages
18 lines
491 B
JavaScript
18 lines
491 B
JavaScript
import { push } from 'react-router-redux';
|
|
|
|
import queryActions from 'redux/nodes/entities/queries/actions';
|
|
import { renderFlash } from 'redux/nodes/notifications/actions';
|
|
|
|
export const fetchQuery = (dispatch, queryID) => {
|
|
return dispatch(queryActions.load(queryID))
|
|
.catch((errorResponse) => {
|
|
const { error } = errorResponse;
|
|
|
|
dispatch(push('/queries/new'));
|
|
dispatch(renderFlash('error', error));
|
|
|
|
return false;
|
|
});
|
|
};
|
|
|
|
export default { fetchQuery };
|