-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
178 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6" | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
export const USER_REGISTER_REQUEST = 'USER_REGISTER_REQUEST'; | ||
export const USER_REGISTER_SUCCESS = 'USER_REGISTER_SUCCESS'; | ||
export const USER_REGISTER_FAIL = 'USER_REGISTER_FAIL'; | ||
export const USER_REGISTER_REQUEST = "USER_REGISTER_REQUEST"; | ||
export const USER_REGISTER_SUCCESS = "USER_REGISTER_SUCCESS"; | ||
export const USER_REGISTER_FAIL = "USER_REGISTER_FAIL"; | ||
|
||
export const USER_SIGNIN_REQUEST = 'USER_SIGNIN_REQUEST'; | ||
export const USER_SIGNIN_SUCCESS = 'USER_SIGNIN_SUCCESS'; | ||
export const USER_SIGNIN_FAIL = 'USER_SIGNIN_FAIL'; | ||
export const USER_SIGNOUT = 'USER_SIGNOUT'; | ||
export const USER_SIGNIN_REQUEST = "USER_SIGNIN_REQUEST"; | ||
export const USER_SIGNIN_SUCCESS = "USER_SIGNIN_SUCCESS"; | ||
export const USER_SIGNIN_FAIL = "USER_SIGNIN_FAIL"; | ||
export const USER_SIGNOUT = "USER_SIGNOUT"; | ||
|
||
export const USER_DETAILS_REQUEST = "USER_DETAILS_REQUEST"; | ||
export const USER_DETAILS_SUCCESS = "USER_DETAILS_SUCCESS"; | ||
export const USER_DETAILS_FAIL = "USER_DETAILS_FAIL"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React, { useEffect } from "react"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { detailsUser } from "../actions/userActions"; | ||
import LoadingBox from "../components/LoadingBox"; | ||
import MessageBox from "../components/MessageBox"; | ||
|
||
function ProfileScreen() { | ||
const userSignin = useSelector((state) => state.userSignin); | ||
const { userInfo } = userSignin; | ||
const userDetails = useSelector((state) => state.userDetails); | ||
const { loading, error, user } = userDetails; | ||
|
||
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
dispatch(detailsUser(userInfo.id)); | ||
}, [dispatch, userInfo.id]); | ||
const submitHandler = (e) => { | ||
e.preventDefault(); | ||
|
||
}; | ||
return ( | ||
<div> | ||
<form className="form" onSubmit={submitHandler}> | ||
<div> | ||
<h1>User Profile</h1> | ||
</div> | ||
{loading ? ( | ||
<LoadingBox></LoadingBox> | ||
) : error ? ( | ||
<MessageBox variant="danger">{error}</MessageBox> | ||
) : ( | ||
<> | ||
<div> | ||
<label htmlFor="name">Name</label> | ||
<input | ||
id="name" | ||
type="text" | ||
placeholder="Enter name" | ||
value={user.name} | ||
></input> | ||
</div> | ||
<div> | ||
<label htmlFor="email">Email</label> | ||
<input | ||
id="email" | ||
type="email" | ||
placeholder="Enter email" | ||
value={user.email} | ||
></input> | ||
</div> | ||
<div> | ||
<label htmlFor="password">Password</label> | ||
<input | ||
id="password" | ||
type="password" | ||
placeholder="Enter password" | ||
></input> | ||
</div> | ||
<div> | ||
<label htmlFor="confirmPassword">Confirm password</label> | ||
<input | ||
id="confirmPassword" | ||
type="password" | ||
placeholder="Enter password again" | ||
></input> | ||
</div> | ||
<div> | ||
<label /> | ||
<button className="primary" type="submit"> | ||
Update | ||
</button> | ||
</div> | ||
</> | ||
)} | ||
</form> | ||
</div> | ||
); | ||
} | ||
|
||
export default ProfileScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters