{"size": 1770, "ext": "js", "max_stars_repo_path": "posthere/src/components/Loginfn.js", "max_stars_repo_name": "Build-Week-Post-Here-Subreddit-Select/front-end-posthere", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "posthere/src/components/Loginfn.js", "max_issues_repo_name": "Build-Week-Post-Here-Subreddit-Select/front-end-posthere", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "posthere/src/components/Loginfn.js", "max_forks_repo_name": "Build-Week-Post-Here-Subreddit-Select/front-end-posthere", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.2307692308, "max_line_length": 95, "alphanum_fraction": 0.4706214689}
// import React, { useState } from "./node_modules/react";
// import { useHistory } from "./node_modules/react-router-dom"
// import { axiosWithAuth } from "../api/axiosWithAuth";

// const Loginfn = () =>{
//     const [user,setUser] = useState({
//         loginItems:{
//             username:"",
//             password:"",
//         }
//     })


//     const history = useHistory();

//     const handleChange = (e) =>{
//         setUser({
//             loginItems:{
//                 ...user.loginItems,
//                 [e.target.name]: e.target.value
//             }
//         })
//     }

//     const login = (e) =>{
//         e.preventDefault();
//         axiosWithAuth()
//         .post("https://posthere-subreddit-app.herokuapp.com/api/auth/login",user.loginItems)
//         .then((res) =>{
//             console.log(res)
//             window.localStorage.setItem("token", res.data.payload)
//             history.push("/postlist")
//         })
//         .catch((err) => console.log(err))
//     }

//     return(
//         <div className= "login-form">
//           <h1>Posthere</h1>

//       <form onSubmit={login}>
//         <label>Username:</label>
//         <input
//           type="text"
//           name="username"
//           value={user.loginItems.username}
//           onChange={handleChange}
//           placeholder="Enter Username"
//         />
//         <label>Password:</label>
//         <input
//           placeholder="Enter Password"
//           type="password"
//           name="password"
//           value={user.loginItems.password}
//           onChange={handleChange}

//         />
//         <button type="submit">Log in</button>
//       </form>
//     </div>
//     )
// }
// export default Loginfn;
