fleet/frontend/components/EmailTokenRedirect/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

26 lines
686 B
JavaScript

import PATHS from "router/paths";
import { push } from "react-router-redux";
import { renderFlash } from "redux/nodes/notifications/actions";
import userActions from "redux/nodes/entities/users/actions";
const confirmEmailChange = (dispatch, token, user) => {
if (user && token) {
return dispatch(userActions.confirmEmailChange(user, token))
.then(() => {
dispatch(push(PATHS.USER_SETTINGS));
dispatch(renderFlash("success", "Email updated successfully!"));
return false;
})
.catch(() => {
dispatch(push(PATHS.LOGIN));
return false;
});
}
return Promise.resolve();
};
export default { confirmEmailChange };