MCPcopy Create free account
hub / github.com/basir/node-react-ecommerce / register

Function register

frontend/src/actions/userActions.js:37–46  ·  view source on GitHub ↗
(name, email, password)

Source from the content-addressed store, hash-verified

35}
36
37const register = (name, email, password) => async (dispatch) => {
38 dispatch({ type: USER_REGISTER_REQUEST, payload: { name, email, password } });
39 try {
40 const { data } = await Axios.post("/api/users/register", { name, email, password });
41 dispatch({ type: USER_REGISTER_SUCCESS, payload: data });
42 Cookie.set('userInfo', JSON.stringify(data));
43 } catch (error) {
44 dispatch({ type: USER_REGISTER_FAIL, payload: error.message });
45 }
46}
47
48const logout = () => (dispatch) => {
49 Cookie.remove("userInfo");

Callers 1

submitHandlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected