Login.test.js:-
import { shallow, mount } from "enzyme";
import renderer from "react-test-renderer";
import Login from "../Login";
import { Provider } from "react-redux";
//import LoginReducer from "../../../redux/reducers/loginReducer";
import configureStore from "redux-mock-store";
const mockStore = configureStore([]);
describe("Login Component", () => {
let store;
let jsx;
beforeEach(() => {
store = mockStore({ login: { email: "", password: "" } });
jsx = (
<Provider store={store}>
<Login />
</Provider>
);
});
it("should render an email input tag", () => {
const wrapper = shallow(jsx);
expect(wrapper.find("Field[type='email']").exists()).toBe(true);
});
it("should render a password input tag", () => {
const wrapper = shallow(jsx);
expect(wrapper.find('Field[type="password"]').exists()).toBe(true);
});
it("should render a submit button", () => {
const wrapper = shallow(jsx);
expect(wrapper.find('button[type="submit"]').exists()).toBe(true);
});
});
Appstore:-
/** combine reducers*/
let rootReducer = combineReducers({
register: RegisterReducer,
login: LoginReducer
Login.js:-
import { React, useState, useEffect, useContext } from "react";
import { useHistory } from "react-router";
import "./common_style.css";
import { connect } from "react-redux";
import * as actionCreator from "../../redux/actions/userActionCreater";
import "../common/common_style.css";
import {
Grid,
Paper,
Avatar,
TextField,
Button,
Typography,
Link,
} from "#material-ui/core";
import LockOutlinedIcon from "#material-ui/icons/LockOutlined";
import FormControlLabel from "#material-ui/core/FormControlLabel";
import Checkbox from "#material-ui/core/Checkbox";
import InputAdornment from "#material-ui/core/InputAdornment";
import AccountCircle from "#material-ui/icons/AccountCircle";
import LockIcon from "#material-ui/icons/Lock";
import { Formik, Form, Field, ErrorMessage } from "formik";
import * as Yup from "yup";
//import { propTypes } from "react-bootstrap/esm/Image";
import InitializeReduxState from "./InitializeReduxState";
const paperStyle = {
padding: 20,
height: "70vh",
width: 280,
margin: "60px auto",
marginTop: "110px",
};
const avatarStyle = { backgroundColor: "#1bbd7e" };
const btnstyle = { margin: "8px 0" };
const Login = (props) => {
const initialValues = {
email: "",
password: "",
};
const validationSchema = Yup.object().shape({
email: Yup.string().email("Please enter valid email").required("Required"),
password: Yup.string("Enter your password")
.required("Required")
.min(4, "Password should be of minimum 4 characters length"),
});
const onSubmit = (values) => {
const payload = { email: values.email, password: values.password };
props.login(payload);
};
let history = useHistory();
useEffect(() => {
if (props.isLoggedIn === true) {
props.flashNotification({
message: "Login Succeessful...",
type: "success",
});
if (props.role === "admin") {
history.push("/admin");
} else if (props.role === "patient") {
patientStatus();
} else {
history.push("/physician");
}
}
}, []);
const patientStatus = () => {
if (props.currentUser.isActive) {
history.push("/demographics");
} else {
history.push("/patientinactive");
}
};
return (
<>
<Grid>
<Paper elevation={10} style={paperStyle}>
<Grid align="center">
<Avatar style={avatarStyle}>
<LockOutlinedIcon />
</Avatar>
<br />
<h4>Sign In</h4>
</Grid>
<Formik
initialValues={initialValues}
onSubmit={onSubmit}
validationSchema={validationSchema}
>
{(props) => (
<Form>
<Field
as={TextField}
label="Email"
margin="normal"
type="text"
name="email"
// onChange={handleUserChange}
placeholder="Enter email"
fullWidth
InputProps={{
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
),
}}
variant="standard"
helperText={<ErrorMessage name="email" />}
/>
<Field
as={TextField}
label="password"
placeholder="Enter password"
type="password"
name="password"
// onChange={handleUserChange}
fullWidth
InputProps={{
startAdornment: (
<InputAdornment position="start">
<LockIcon />
</InputAdornment>
),
}}
helperText={<ErrorMessage name="password" />}
/>
<Button
type="submit"
color="primary"
variant="contained"
style={btnstyle}
fullWidth
>
Sign in
</Button>
</Form>
)}
</Formik>
<Typography> Do you have an account ?</Typography>
Sign Up
<p className="text text-danger fw-bold text-center">
{props.globalmessage}!!!
</p>
</Paper>
</Grid>
<InitializeReduxState />
</>
);
};
const mapStatetoProps = (state) => {
return {
isLoggedIn: state.login.isLoggedIn,
role: state.login.role,
globalmessage: state.login.globalmessage,
authToken: state.login.authToken,
currentUser: state.login.loggedUserInfo,
};
};
const mapDispatchToProps = (dispatch) => {
return {
login: (user) => dispatch(actionCreator.Login(user)),
};
};
let hof = connect(mapStatetoProps, mapDispatchToProps);
export default hof(Login);
Here I have tested my Login component with some simple test cases and I have also mock my store because my application is using Redux but it is giving me error like
expect(received).toBe(expected) // Object.is equality
Expected: true
Received: false
I have a doubt that in beforeeach I have used the email and password. Is it correct? Is there is something that I have done wrong?
Related
I wanted to avoid redirecting user to homepage when there is an error while submitting the form during dispatching with redux action. Whenever we have error I am throwing one error message but not able to stop navigating towards the homepage. I am getting everything from store to stop redirecting user to homepage but it's not working. Can you please tell me what is going wrong with below code ?
import React, { useState, useEffect } from "react";
import { makeStyles } from "#material-ui/core/styles";
import { useHistory } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
import {
addContactStart,
} from "../redux/contacts/contacts.actions";
import { MDBInput, MDBBtn, MDBTypography, MDBIcon } from "mdb-react-ui-kit";
import { toast } from "react-toastify";
const useStyles = makeStyles((theme) => ({
root: {
margin: "auto",
padding: "30px",
maxWidth: "500px",
alignContent: "center",
"& > *": {
margin: theme.spacing(1),
width: "45ch",
},
},
}));
const initialState = {
name: "",
mobile: "",
email: "",
};
const AddContact = () => {
const classes = useStyles();
const { contact, contacts, loading, error } = useSelector(
(state) => state.data
);
const { token } = useSelector((state) => state.auth);
const [state, setState] = useState(initialState);
const [emptyErrorMsg, setEmptyErrorMsg] = useState("");
let history = useHistory();
let dispatch = useDispatch();
const { name, email, mobile } = state;
const handleInputChange = (e) => {
let { name, value } = e.target;
setState({ ...state, [name]: value });
};
useEffect(() => error && toast.error(error), [error]);
const handleSubmit = (e) => {
e.preventDefault();
if (!name || !email || !mobile) {
setEmptyErrorMsg("Please fill all input Field");
} else {
dispatch(addContactStart({ state, token }));
if (!error) {
history.push("/");
setEmptyErrorMsg("");
}
}
};
return (
<div>
{emptyErrorMsg && (
<MDBTypography style={{ color: "red" }}>{emptyErrorMsg}</MDBTypography>
)}
<form
className={classes.root}
noValidate
autoComplete="off"
onSubmit={handleSubmit}
>
<MDBInput
label="Name"
value={name || ""}
name="name"
type="text"
onChange={handleInputChange}
/>
<br />
<MDBInput
label="Email"
name="email"
value={email || ""}
type="email"
onChange={handleInputChange}
/>
<br />
<MDBInput
label="Contact"
value={mobile || ""}
name="mobile"
type="number"
onChange={handleInputChange}
/>
<br />
<MDBBtn
style={{ width: "100px" }}
type="submit"
onChange={handleInputChange}
>
Submit
</MDBBtn>
</form>
</div>
);
};
export default AddContact;
I have an action to login user using axios post request. but the action function is not being called on clicking login button in my functional component.
here is the action function
import {
SET_USER,
SET_ERRORS,
CLEAR_ERRORS,
LOADING_UI,
SET_AUTHENTICATED,
SET_UNAUTHENTICATED
} from "../types";
import axios from "axios";
export const loginUser = (userData) => (dispatch) => {
dispatch({ type: LOADING_UI });
axios
.post("/api/auth/login", userData)
.then((res) => {
const FBIdToken = `Bearer ${res.data.token}`;
localStorage.setItem("FBIdToken", FBIdToken);
axios.defaults.headers.common["Authorization"] = FBIdToken;
dispatch(getUserData());
dispatch({ type: CLEAR_ERRORS });
window.location = "/";
})
.catch((err) => {
dispatch({
type: SET_ERRORS,
payload: err.response.data
});
});
};
export const getUserData = () => (dispatch) => {
axios
.get("/api/user")
.then((res) => {
dispatch({
type: SET_USER,
payload: res.data
});
})
.catch((err) => console.log(err));
};
and here is my functional component.
i have logged statements before and after the function call, both are being printed but the function is not being executed
import React, { useState } from "react";
import PropTypes from "prop-types";
import AppIcon from "../images/icon.png";
import axios from "axios";
import { Link } from "react-router-dom";
//MUI imports
import withStyles from "#material-ui/core/styles/withStyles";
import Grid from "#material-ui/core/Grid";
import Typography from "#material-ui/core/Typography";
import TextField from "#material-ui/core/TextField";
import Button from "#material-ui/core/Button";
import CircularProgress from "#material-ui/core/CircularProgress";
//Redux
import { connect } from "react-redux";
import { loginUser } from "../Redux/actions/userActions";
const styles = {
form: {
textAlign: "center"
},
image: {
margin: "20px auto 20px auto"
},
pageTitle: {
margin: "10px auto"
},
textField: {
margin: "10px auto"
},
button: {
marginTop: 20,
position: "relative"
},
customError: {
color: "red"
},
progress: {
position: "absolute"
}
};
function Login({ classes, UI: { loading } }) {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [errors, setErrors] = useState({});
const handleSubmit = (e) => {
e.preventDefault();
const userData = {
email: email,
password: password
};
console.log("before");
loginUser(userData);
console.log("after");
};
return (
<Grid container className={classes.form}>
<Grid item sm />
<Grid item sm>
<img src={AppIcon} alt="app logo" className={classes.image} />
<Typography variant="h2" className={classes.pageTitle}>
Login
</Typography>
<form noValidate onSubmit={handleSubmit}>
<TextField
id="email"
name="Email"
type="email"
label="Email"
className={classes.textField}
helperText={errors.email}
error={errors.email ? true : false}
value={email}
onChange={(e) => setEmail(e.target.value)}
fullWidth
/>
<TextField
id="password"
name="password"
type="password"
label="Password"
className={classes.textField}
helperText={errors.password}
error={errors.password ? true : false}
value={password}
onChange={(e) => setPassword(e.target.value)}
fullWidth
/>
{errors.error && (
<Typography variant="body2" className={classes.customError}>
Wrong credentials, please try again.
</Typography>
)}
<Button
type="submit"
variant="contained"
color="primary"
className={classes.button}
disabled={loading}
>
Login
{loading && (
<CircularProgress size={30} className={classes.progress} />
)}
</Button>
<br />
<small>
don't have an account? Signup <Link to="/signup">here</Link>
</small>
</form>
</Grid>
<Grid item sm />
</Grid>
);
}
Login.propTypes = {
classes: PropTypes.object.isRequired,
loginUser: PropTypes.func.isRequired,
user: PropTypes.object.isRequired,
UI: PropTypes.object.isRequired
};
const mapStateToProps = (state) => ({
user: state.user,
UI: state.UI
});
const mapActionsToProps = {
loginUser
};
export default connect(
mapStateToProps,
mapActionsToProps
)(withStyles(styles)(Login));
You should execute the loginUser passed via props, not the one you import at the top of the file, better give it a different name to avoid confusion.
e.g.
function Login({ classes, UI: { loading }, loginUser }) {
I am having a painful moment because of some small issue in my react app.
import React, { useState } from 'react';
import { Box } from '#material-ui/core';
import { connect } from 'react-redux';
import { PropTypes } from 'prop-types';
import { HeadTwo, Text, StdLink } from '../../styled-components/Text';
import { ContainedBtn } from '../../styled-components/Button';
import { TextField } from '../../styled-components/Input';
import { FlexCenter, FlexStart, Form } from '../../styled-components/Layout';
import { login } from '../../redux/auth/actions';
const SignIn = ({ login, history }) => {
const [form, setForm] = useState({
email: '',
password: '',
});
const handleChange = e => {
setForm({
...form,
[e.target.name]: e.target.value,
});
};
const handleSubmit = e => {
e.preventDefault();
login(form, history);
};
return (
<FlexCenter>
<Form onSubmit={e => handleSubmit(e)} width="45rem" mt="20px" mb="20px">
<FlexStart mb={2} borderBottom={2} borderColor="common.dark">
<HeadTwo sz="2.6rem">Sign In</HeadTwo>
</FlexStart>
<TextField mb={2} hidelabel={form.email.length > 0 ? 'none' : null}>
<input
onChange={handleChange}
value={form.email}
type="email"
name="email"
placeholder="email"
id="email"
/>
</TextField>
<TextField mb={2} hidelabel={form.password.length > 0 ? 'none' : null}>
<input
onChange={handleChange}
value={form.password}
type="password"
placeholder="password"
name="password"
id="password"
/>
</TextField>
<Box mb={1}>
<ContainedBtn bg="#000" cr="#fff">
LOGIN
</ContainedBtn>
</Box>
<FlexCenter mb={1}>
<Text> Don't have an account? </Text>
<Box ml={1}>
<StdLink to="/register">register</StdLink>
</Box>
</FlexCenter>
<FlexCenter mb={1}>
<Text> Forget your password?</Text>
<Box ml={1}>
<StdLink>recover</StdLink>
</Box>
</FlexCenter>
</Form>
</FlexCenter>
);
};
SignIn.propTypes = {
login: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
};
export default connect(
null,
{ login }
)(SignIn);
so this is my signIn component and login function is yelling at me saying 'login is already declared in upper scope', which is quite weird because login prop comes from connect fn right?
anyway, So I tried changing eslint rule like this
{
"rules": {
"no-shadow": [
"error",
{ "builtinGlobals": false, "hoist": "never", "allow": [] }
]
}
}
since I set hoist to never, the warning should be gone, but it still remained.
does anyone know what I did wrong?
thanks !!
The login function that is imported will not work since you have parameter with the same name. You just need to rename:
const SignIn = ({ login: signin, history }) => {
// now the imported login will work
// to use login parameter, you now have signin
I'm trying to submit a form when a user signUp. When the submit button clicked an action creator should executed to start an asynchronous action but actually the submit is not triggered and the action creator is not launched.
actions.ts:
import { ActionTypes } from "./types";
import { SignUpUser, User } from "../apis/authentication";
import { AxiosError } from "axios";
import { Dispatch } from "redux";
export interface ReturnedUser {
username: string;
}
export interface SignUpSuccessAction {
type: ActionTypes.SucceedSignUp;
payload: ReturnedUser;
}
export interface SignUpFailAction {
type: ActionTypes.FailSignUp;
payload: string;
}
export interface SignUpStartAction {
type: ActionTypes.StartSignUp;
}
const signUpStarted = (): SignUpStartAction => ({
type: ActionTypes.StartSignUp
});
const signUpSucceeded = (user: ReturnedUser): SignUpSuccessAction => ({
type: ActionTypes.SucceedSignUp,
payload: user
});
const signUpFailed = (error: string): SignUpFailAction => ({
type: ActionTypes.FailSignUp,
payload: error
});
export const signUpFetch = (user: User) => {
return async (dispatch: Dispatch) => {
dispatch(signUpStarted());
SignUpUser(user).then(
(response: any) => {
const { username } = response;
return dispatch(signUpSucceeded(username));
},
(error: AxiosError) => {
let errorMessage = "Internal Server Error";
if (error.response) {
errorMessage = error.response.data;
}
return dispatch(signUpFailed(errorMessage));
}
);
};
};
reducers/reducer.ts:
import { Action, ActionTypes } from "../actions";
export const SignUpReducer = (state = {}, action: Action) => {
switch (action.type) {
case ActionTypes.SucceedSignUp:
return { ...state, user: action.payload };
case ActionTypes.FailSignUp:
return { ...state, error: action.payload };
default:
return state;
}
};
reducers/index.ts:
import { SignUpReducer } from "./signUp";
import { combineReducers } from "redux";
export const reducer = combineReducers({
signUp: SignUpReducer
});
index.tsx:
import React from "react";
import ReactDOM from "react-dom";
import SignUp from "./containers/Signup/SignUp";
import { Provider } from "react-redux";
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import { reducer } from "./reducers/index";
const store = createStore(reducer, composeWithDevTools(applyMiddleware(thunk)));
const App = () => <SignUp />;
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById("root")
);
SignUp.tsx:
import React, { useState } from "react";
import Button from "#material-ui/core/Button";
import { connect } from "react-redux";
import { Form, Field } from "react-final-form";
import { makeStyles, Theme, createStyles } from "#material-ui/core/styles";
import Grid from "#material-ui/core/Grid";
import CardWrapper from "../../components/CardWrapper";
import PasswordField from "../../components/Password";
import TextField from "../../components/TextField";
import { validate, submit } from "./validation";
const useStyles = makeStyles((theme: Theme) =>
createStyles({
container: {
padding: 16,
margin: "auto",
maxWidth: "100%",
flexGrow: 1
},
paper: {
padding: 16
},
item: {
marginTop: 16
}
})
);
const SignUp = () => {
const classes = useStyles();
const [showPassword, setPassword] = useState(false);
const handleClickShowPassword = () => {
setPassword(!showPassword);
};
const handleMouseDownPassword = (
event: React.MouseEvent<HTMLButtonElement>
) => {
event.preventDefault();
};
return (
<div className={classes.container}>
<Form
onSubmit={submit}
validate={validate}
render={({ handleSubmit, form, submitting, pristine }) => (
<form onSubmit={handleSubmit}>
<CardWrapper title='SignUp Form'>
<Grid container justify='center' spacing={3}>
<Grid item md={12}>
<Field fullWidth required name='username'>
{props => (
<TextField
label='Username'
type='text'
value={props.input.value}
onChange={props.input.onChange}
onBlur={props.input.onBlur}
meta={props.meta}
fullWidth={true}
/>
)}
</Field>
</Grid>
<Grid item md={12}>
<Field fullWidth required name='email'>
{props => (
<TextField
label='Email'
type='email'
value={props.input.value}
onChange={props.input.onChange}
onBlur={props.input.onBlur}
meta={props.meta}
fullWidth={true}
/>
)}
</Field>
</Grid>
<Grid item md={12}>
<Field fullWidth required name='password'>
{props => (
<PasswordField
value={props.input.value}
handleChange={props.input.onChange}
showPassword={showPassword}
handleClickShowPassword={handleClickShowPassword}
handleMouseDownPassword={handleMouseDownPassword}
fullWidth={true}
onBlur={props.input.onBlur}
meta={props.meta}
/>
)}
</Field>
</Grid>
<Grid item className={classes.item}>
<Button
type='button'
variant='contained'
onClick={form.reset}
disabled={submitting || pristine}
>
Reset
</Button>
</Grid>
<Grid item className={classes.item}>
<Button
variant='contained'
color='primary'
type='submit'
disabled={submitting || pristine}
>
Submit
</Button>
</Grid>
</Grid>
</CardWrapper>
</form>
)}
/>
</div>
);
};
export default connect()(SignUp);
validation.ts:
interface SignUpValues {
email: string;
password: string;
username: string;
}
const submit = (values: SignUpValues) => {
const user = {
username: values.username,
email: values.email,
password: values.password
};
return signUpFetch(user);
};
export { submit };
I find a similar question posted about the same issue described by Redux Dispatch Not Working in Action Creator but the answer does not fix my problem. Does I make something wrong when linking the different component with redux?
It wont dispatch because in component You didnt dispatch Your function
return signUpFetch(user)
Instead Connect the component with Redux and dispatch the function
in Index.tsx
import { connect } from 'react-redux';
const mapDispatchToProps = {
submit
};
export default connect(null, mapDispatchToProps)(SignUp);
And access it with
this.props.submit
Add dispatch in Submit function
const submit = (values: SignUpValues) =>(dispatch, getState)=> {
const user = {
username: values.username,
email: values.email,
password: values.password
};
return dispatch(signUpFetch(user));
};
Whenever you need to update redux state, dispatch the function from where it is also called and also in the actions.
You need to connection the component to the store when you do the dispatch:
import { connect } from 'react-redux';
const submit = (values: SignUpValues) => {
const user = {
username: values.username,
email: values.email,
password: values.password
};
return this.props.signUpFetch(user);
};
export const connectedSubmit = connect(null, {signUpFetch})(submit);
import { validate, connectedSubmit as submit } from "./validation";
And also you can just return at SignUpUser
export const signUpFetch = (user: User) => {
return async (dispatch: Dispatch) => {
dispatch(signUpStarted());
return SignUpUser(user).then(
(response: any) => {
const { username } = response;
dispatch(signUpSucceeded(username));
},
(error: AxiosError) => {
let errorMessage = "Internal Server Error";
if (error.response) {
errorMessage = error.response.data;
}
dispatch(signUpFailed(errorMessage));
}
);
};
}
So I am using react, redux and firebase for this small crud app, whenever a new employee is created I redirect to the home component which should display all the employees created including the new one. But the new employee isn't showing up after redirection from create employee. What seems to be the issue, essentially I want is for the Home component to update with the new data.
Home.js
import React, { Component } from 'react'
import { connect } from 'react-redux'
import EmployeesList from '../employees/EmployeesList'
import { firestoreConnect } from 'react-redux-firebase'
import { compose } from 'redux'
class Home extends Component {
render() {
const { employees } = this.props
return (
<div>
<EmployeesList employees={employees} />
</div>
)
}
}
const mapStateToProps = (state) => {
// console.log(state)
return ({
employees: state.firestore.ordered.employees
})
}
export default compose(
connect(mapStateToProps),
firestoreConnect([
{ collection: 'employees', orderBy: ['createdAt', 'desc'] }
])
)(Home)
CreateEmployee.js
import React, { Component } from 'react'
import { compose } from 'redux'
import { connect } from 'react-redux'
import { withRouter } from "react-router";
import { createEmployee } from '../../store/actions/employeeActions'
import { withStyles } from '#material-ui/core/styles';
import Button from '#material-ui/core/Button';
import TextField from '#material-ui/core/TextField';
import Typography from '#material-ui/core/Typography';
const styles = theme => ({
bt_create: {
margin: theme.spacing.unit,
padding: '10'
},
input: {
display: 'none',
},
});
class CreateEmployee extends Component {
state = {
name: '',
email: '',
department: '',
salary: ''
}
handleChange = e => {
this.setState({
[e.target.id]: e.target.value
})
}
handleSubmit = e => {
e.preventDefault()
// console.log(this.state)
// TODO store state data in db
this.props.createEmployee(this.state)
this.props.history.push({
pathname: '/'
})
}
render() {
return (
<div>
<br />
<Typography variant="h6" color="inherit">
Create new employee
</Typography>
<form onSubmit={this.handleSubmit}>
<TextField
id="name"
label="Name"
defaultValue=""
margin="normal"
onChange={this.handleChange}
/>
<br />
<TextField
id="email"
label="Email"
defaultValue=""
margin="normal"
onChange={this.handleChange}
/>
<br />
<TextField
id="department"
label="Department"
defaultValue=""
margin="normal"
onChange={this.handleChange}
/>
<br />
<TextField
id="salary"
label="Salary"
defaultValue=""
margin="normal"
onChange={this.handleChange}
/>
<br />
<br />
<Button type="submit" variant="contained" color="primary" className="bt_create">Create</Button>
</form>
</div>
)
}
}
const mapDispatchToProps = dispatch => {
return {
createEmployee: (employee) => dispatch(createEmployee(employee))
}
}
export default compose(
withStyles(styles),
withRouter,
connect(null, mapDispatchToProps)
)(CreateEmployee)
Create employee action
export const createEmployee = employee => {
return (dispatch, getState, { getFirebase, getFirestore }) => {
const firestore = getFirestore()
// TODO add employee here
firestore.collection('employees').add({
...employee,
createdAt: new Date(),
updatedAt: new Date()
}).then(() => {
dispatch({
type: 'CREATE_EMPLOYEE_SUCCESS',
employee: employee
})
}).catch((err) => {
dispatch({ type: 'CREATE_EMPLOYEE_ERROR', err })
})
}