Skip to content

Commit

Permalink
update login infor
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenvanhuan243 committed Apr 13, 2024
1 parent b075215 commit 577b065
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/components/Popup/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ import UserUtils from '../../../utils/user/UserUtils';
import UserAPI from '../../../api/backend/users';

const Login = ({ showPopup = false, closeLoginForm }) => {
const [userEmail, setUserEmail] = useState("");
const [userPassword, setUserPassword] = useState("");
const [userInfo, setUserInfo] = useState({})

const onLogin = () => {
const userParams = {
email: userEmail,
password: userPassword
}
UserAPI.login(userParams).then(response => {
UserAPI.login(userInfo).then(response => {
const accessToken = response.data.access_token
UserUtils.setAccessToken(accessToken);
UserAPI.getUserByAccessToken(accessToken).then(response => {
Expand Down Expand Up @@ -51,7 +46,7 @@ const Login = ({ showPopup = false, closeLoginForm }) => {
margin="normal"
variant="outlined"
className="Login-emailField"
onChange={(e) => setUserEmail(e.target.value)}
onChange={(e) => setUserInfo({ ...userInfo, email: e.target.value })}
/>
</div>
<div>
Expand All @@ -62,7 +57,7 @@ const Login = ({ showPopup = false, closeLoginForm }) => {
margin="normal"
variant="outlined"
className="Login-passwordField"
onChange={(e) => setUserPassword(e.target.value)}
onChange={(e) => setUserInfo({ ...userInfo, password: e.target.value })}
/>
</div>
<div>
Expand Down

0 comments on commit 577b065

Please sign in to comment.