-
Notifications
You must be signed in to change notification settings - Fork 0
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
Front end #28
Merged
Merged
Front end #28
Conversation
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 update wraps the app component in a ContextProvider to enable global state sharing across components, improving state handling.
isAuthenticated: (default: false): this variable will be set to true if the use is authenticated using (PrivateRoute) user: (defaul: null): This will be the users first and last name and the avatar setAuth: to update the value of isAuthenticated setUser: updates teh value of user Return: return the context provider with the above variables and functions
- Created PrivateRoute component to manage route access based on user authentication status. - Utilizes DataContext to retrieve and update authentication state (isAuthenticated, setAuth, setUser). - Checks token validity by making an API request to /api/auth_validate. - Renders component if user is authenticated or redirects to /auth if not. - Supports public routes via the "open" prop, allowing unrestricted access when set to true.
add a handleSubmit for both signin and signup forms - Added form submission handler to validate all fields before submitting. Signup: - send a post request to the api/register route with the information needed to create a new user - if the return is 201 (created) the user will be prompt with the login window - else an error message will be displayed describing the error Signin: - send a post request to the api/login route with the information needed to log user {email, password} - the return of this requets in a success is {token, 'token...'} or an error: message - if the return status is 200 the token will be saved in the local storage of the browser and the user will be redirected to home - else the field will be create for a new input
Badr-Annabi
approved these changes
Sep 15, 2024
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.
Fantastic Job
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
Changes Made
Related Issue
Type of Change
How Has This Been Tested?
Checklist:
Additional Notes