-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Login UI Issue#14 #26
Conversation
Update @anitab-org/bridgeintech-maintainers , Just pushed this Login form as user interface. Form validation |
Update @anitab-org/bridgeintech-maintainers . This form now has error responses shown to user. I still need to workout how to persist the jwt token that got returned and carry that to the next page. @meenakshi-dhanani if you can give me some guidance in this, that'll be great. 😉 |
bea2e8f
to
4913271
Compare
Try and have more meaningful commit messages which indicate intent. eg. Allow a user to login. |
src/login/Login.jsx
Outdated
|
||
new FormData(e.target).forEach((value, key) => { | ||
if (key === "username") | ||
userInput[key] = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need an if else statement here? The action that you are performing is the same either ways.
Why can't it simply be userInput[key] = value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed
src/login/Login.jsx
Outdated
type="text" | ||
name="username" | ||
placeholder="Username or Email" | ||
onChange={e => setUsername(e.target.value)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need to set here. You are fetching the values from FormData anyway. So even if you set here, it's not being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. remove onChange
4913271
to
128e9ae
Compare
Update @anitab-org/bridgeintech-maintainers and @meenakshi-dhanani . I've just pushed the changes requested in your review. Can you please re-review? Thanks |
Posted this in a wrong PR 🤣
|
128e9ae
to
0bc39dd
Compare
@meenakshi-dhanani and @anitab-org/bridgeintech-maintainers . I've pull rebased the latest merged to develop and fixed few things mentioned by Meena on the feedback;
PS: While I'm on it, I did the same in Register.js (changed setting up the payload logic and removed unused useState) for consistency. |
src/login/Login.jsx
Outdated
|
||
|
||
export default function Login() { | ||
const [errorMessage, setResponseMessage] = useState(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errorMessage, setErrorMessage - try following the convention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, missed that 😁
ee1b537
to
7426086
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested the following scenarios:
- Redirect to My Space on successful login
- Show error message when server is down
- Show appropriate error for invalid credentials (401)
The unit tests for these also have passed. Approving!
@foongminwong could you test these? I've done a code review for Maya. I'm hoping you can add gifs and screenshots 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes made in this PR were tested locally. Following are the results:
-
Code review - Done by @meenakshi-dhanani
-
All possible responses were tested as below (tap/zoom in to see clearer gifs):
-
Additional testcases covered: N/A
-
Additional Comments:
- Great job @mtreacy002 !! Merge Time ⏲
- OS Version: Windows 10
Wowww....That's an amazing tests report, @foongminwong. Thank youuu... 😍 |
Description
Add Login UI
Fixes #14 and #29
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
required
gave warning as expected.link to Gif
Note to tester/reviewer. To test this login ui you must run the backend server from the latest code change on login backend PR#60
Checklist:
Code/Quality Assurance Only
Additional Note
Up to User Interface only, backend API consumption is not yet added - wip