fleet/frontend/components/queries/QueryPageWrapper/helpers.js
Gabe Hernandez efb35b537a
add prettier and have it format all fleet application code (#625)
* add prettier and have it format all js code except website:
:

* trying running prettier check in CI

* fix runs on in CI

* change CI job name

* fix prettier erros and fix CI
2021-04-12 14:32:25 +01:00

19 lines
593 B
JavaScript

import { push } from "react-router-redux";
import { join, omit, values } from "lodash";
import PATHS from "router/paths";
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((errors) => {
const errorMessage = join(values(omit(errors, "http_status")), ", ");
dispatch(push(PATHS.NEW_QUERY));
dispatch(renderFlash("error", errorMessage));
return false;
});
};
export default { fetchQuery };