Saksham2k3s / Ecommerce-store

1 stars 1 forks source link

BUG: Persisting User Authentication in Redux #1

Open Saksham2k3s opened 4 months ago

Saksham2k3s commented 4 months ago

Description:

New to Redux and encountering a challenge: I need to manage user authentication in my application using Redux. Specifically, I want to store user login information in the Redux state after successful login or registration. Additionally, I aim to ensure that users remain authenticated for a certain period without needing to log in repeatedly.

Steps to Implement:

Locate the relevant files:

Review Redux architecture:

Implement authentication logic:

By following these steps and implementing the required logic in your Redux action file, you can effectively manage user authentication in your application and ensure a seamless user experience.

Amrani-Farouk-Hossam-Eddine commented 4 months ago

Hi, i'm interesting , can you sign it to me if there is no one currently working on it

Saksham2k3s commented 4 months ago

Yaa sure @Amrani-Farouk-Hossam-Eddine Please help me!

Amrani-Farouk-Hossam-Eddine commented 4 months ago

i want to ask you a question , you have the slices and store of redux what is the problem you are facing exactly so i can understand better

Saksham2k3s commented 4 months ago

We have a file named LoginSignUp.jsx located at /frontend/src/Pages/User. After filling out the login and signup forms, we dispatch the userLogin() function. Upon successful login, we receive user information from the backend, including the user's data and a JWT token. This token is stored on the backend for a specific duration. Once a user is logged in, there is no need to prompt them to login again. The login data should be stored in the state to enable access to other authenticated pages such as the user profile, ordering products, etc.