function Register() {
  const history = useHistory();
  const classes = useStyles();
  const [user, updateItemInUser] = useState({});

  const handleChange = (event) => {
    let localUserItem = {
      ...user,
      ...{ [event.target.name]: event.target.value },
    };
    updateItemInUser(localUserItem);
    console.log(user)
  };
  const handleSubmit = (e) => {
    e.preventDefault();
    try {
      async function saveProduct() {
        let response = await makeRequest({
          method: "POST",
          url: "/v1/addOrUpdateUser",
          data: user,
        });
        if (response.data.code === 200) {
          history.push("/product");
          ToastsStore.success("User register successfully!");
        } else {
          ToastsStore.error(response.data.message);
        }
      }
      saveProduct();
    } catch (error) {
      ToastsStore.error(error.message);
    }
  };

  return (
    <Container component="main" maxWidth="xs" className={classes.gradient}>
      <CssBaseline />
      <div className={classes.paper}>
        <Avatar className={classes.avatar}>Classy</Avatar>
        <Typography component="h1" variant="h5">
          Sign up
        </Typography>
        <form className={classes.form} onSubmit={handleSubmit} noValidate>
          <TextField
            variant="outlined"
            margin="normal"
            required
            fullWidth
            id="fullName"
            label="Full Name"
            name="fullName"
            autoComplete="fullName"
            onChange={handleChange}
            autoFocus
          />{" "}
          <TextField
            variant="outlined"
            margin="normal"
            required
            fullWidth
            id="email"
            label="Email Address"
            onChange={handleChange}
            name="emailId"
            autoComplete="email"
            autoFocus
          />
          <TextField
            variant="outlined"
            margin="normal"
            required
            fullWidth
            name="password"
            onChange={handleChange}
            label="Password"
            type="password"
            id="password"
            autoComplete="current-password"
          />
          <Button
            type="submit"
            fullWidth
            variant="contained"
            color="primary"
            className={classes.submit}
          >
            Sign In
          </Button>
          <Typography
          color="primary"
          onClick={() => {
            history.push(`/`);
          }}
        >
           Have An Account?
        </Typography>
        </form>
      </div>
      <Box mt={8}>
        <Copyright />
      </Box>
      <ToastsContainer store={ToastsStore} />
    </Container>
  );
}
/**
 * Created by Piyush on Sun Nov 22 2020 20:12:37 GMT+0530 (India Standard Time)
 * Register Component
 * Updated by Piyush on Sun Nov 22 2020 20:12:37 GMT+0530 (India Standard Time)
 * Register Component
 */
Created by Piyush on Sun Nov 22 2020 20:12:37 GMT+0530 (India Standard Time)
Register Component
Updated by Piyush on Sun Nov 22 2020 20:12:37 GMT+0530 (India Standard Time)
Register Component
Created by Piyush on Sun Nov 22 2020 20 : 12 : 37 GMT + 0530 ( India Standard Time ) Register Component Updated by Piyush on Sun Nov 22 2020 20 : 12 : 37 GMT + 0530 ( India Standard Time ) Register Component
function Register() {
  const history = useHistory();
  const classes = useStyles();
  const [user, updateItemInUser] = useState({});
  const handleChange = (event) => {
    let localUserItem = {
      ...user,
      ...{ [event.target.name]: event.target.value },
    };
    updateItemInUser(localUserItem);
    console.log(user)
  };
  const handleSubmit = (e) => {
    e.preventDefault();
    try {
      async function saveProduct() {
        let response = await makeRequest({
          method: "POST",
          url: "/v1/addOrUpdateUser",
          data: user,
        });
        if (response.data.code === 200) {
          history.push("/product");
          ToastsStore.success("User register successfully!");
        } else {
          ToastsStore.error(response.data.message);
        }
      }
      saveProduct();
    } catch (error) {
      ToastsStore.error(error.message);
    }
  };
  return (
    <Container component="main" maxWidth="xs" className={classes.gradient}>
      <CssBaseline />
      <div className={classes.paper}>
        <Avatar className={classes.avatar}>Classy</Avatar>
        <Typography component="h1" variant="h5">
          Sign up
        </Typography>
        <form className={classes.form} onSubmit={handleSubmit} noValidate>
          <TextField
            variant="outlined"
            margin="normal"
            required
            fullWidth
            id="fullName"
            label="Full Name"
            name="fullName"
            autoComplete="fullName"
            onChange={handleChange}
            autoFocus
          />{" "}
          <TextField
            variant="outlined"
            margin="normal"
            required
            fullWidth
            id="email"
            label="Email Address"
            onChange={handleChange}
            name="emailId"
            autoComplete="email"
            autoFocus
          />
          <TextField
            variant="outlined"
            margin="normal"
            required
            fullWidth
            name="password"
            onChange={handleChange}
            label="Password"
            type="password"
            id="password"
            autoComplete="current-password"
          />
          <Button
            type="submit"
            fullWidth
            variant="contained"
            color="primary"
            className={classes.submit}
          >
            Sign In
          </Button>
          <Typography
          color="primary"
          onClick={() => {
            history.push(`/`);
          }}
        >
           Have An Account?
        </Typography>
        </form>
      </div>
      <Box mt={8}>
        <Copyright />
      </Box>
      <ToastsContainer store={ToastsStore} />
    </Container>
  );
}
function Register ( ) { const history = useHistory ( ) ; const classes = useStyles ( ) ; const [ user , updateItemInUser ] = useState ( { } ) ; const handleChange = ( event ) => { let localUserItem = { ... user , ... { [ event . target . name ] : event . target . value } , } ; updateItemInUser ( localUserItem ) ; console . log ( user ) } ; const handleSubmit = ( e ) => { e . preventDefault ( ) ; try { async function saveProduct ( ) { let response = await makeRequest ( { method : "POST" , url : "/v1/addOrUpdateUser" , data : user , } ) ; if ( response . data . code === 200 ) { history . push ( "/product" ) ; ToastsStore . success ( "User register successfully!" ) ; } else { ToastsStore . error ( response . data . message ) ; } } saveProduct ( ) ; } catch ( error ) { ToastsStore . error ( error . message ) ; } } ; return ( < Container component = "main" maxWidth = "xs" className = { classes . gradient } > < CssBaseline / > < div className = { classes . paper } > < Avatar className = { classes . avatar } > Classy < / Avatar > < Typography component = "h1" variant = "h5" > 
          Sign up
         < / Typography > < form className = { classes . form } onSubmit = { handleSubmit } noValidate > < TextField variant = "outlined" margin = "normal" required fullWidth id = "fullName" label = "Full Name" name = "fullName" autoComplete = "fullName" onChange = { handleChange } autoFocus / > { " " } < TextField variant = "outlined" margin = "normal" required fullWidth id = "email" label = "Email Address" onChange = { handleChange } name = "emailId" autoComplete = "email" autoFocus / > < TextField variant = "outlined" margin = "normal" required fullWidth name = "password" onChange = { handleChange } label = "Password" type = "password" id = "password" autoComplete = "current-password" / > < Button type = "submit" fullWidth variant = "contained" color = "primary" className = { classes . submit } > 
            Sign In
           < / Button > < Typography color = "primary" onClick = { ( ) => { history . push ( ` ` ) ; } } > 
           Have An Account?
         < / Typography > < / form > < / div > < Box mt = { 8 } > < Copyright / > < / Box > < ToastsContainer store = { ToastsStore } / > < / Container > ) ; }
Created by Piyush on Sun Nov 22 2020 20:12:37 GMT+0530 (India Standard Time)
 Register Component
 Updated by Piyush on Sun Nov 22 2020 20:12:37 GMT+0530 (India Standard Time)
 Register Component
Created by Piyush on Sun Nov 22 2020 20 : 12 : 37 GMT + 0530 ( India Standard Time ) Register Component Updated by Piyush on Sun Nov 22 2020 20 : 12 : 37 GMT + 0530 ( India Standard Time ) Register Component