martin-markovic / learn-connect

Multi-feature platform designed to enhance the online learning experience.
MIT License
0 stars 0 forks source link

Chat #15

Closed martin-markovic closed 2 months ago

martin-markovic commented 2 months ago

Summary

This pull request includes significant updates and improvements to the frontend and backend codebases. The changes involve removing redundant files and dependencies, installing necessary packages, integrating Redux for state management, setting up authentication components, and updating server configurations to support CORS with credentials.

Changes

  1. File and Dependency Cleanup

    • Deleted main.js file.
    • Removed Socket.IO integration from index.html.
    • Removed main.js integration from index.html.
    • Uninstalled redundant Babel dependencies: @babel/core and @babel/preset-react.
  2. Package Installation

    • Installed necessary packages: @reduxjs/toolkit, axios, react-icons, react-redux.
  3. Server Updates

    • Removed /js/main.js redundant API endpoint from server.js.
    • Added credentials: true option to CORS origin in server.js.
    • Integrated CORS with credentials support to allow requests from the frontend address in server.js.
  4. Frontend Integration

    • Integrated ./index.css into index.js.
    • Implemented Register.jsx and Login.jsx to render authentication form data.
    • Integrated Login and Register components into their respective route paths in App.js.
    • Removed the redundant React import from Chat.jsx.
    • Added simple layout styling in index.css.
  5. Authentication Handling

    • Implemented registerUser function to send POST requests with axios and set user data to local storage in authService.js.
    • Implemented async thunk registerUser for user registration, handling success and error cases.
    • Implemented initialState, reducers, and extraReducers to handle redux state management in authSlice.js.
    • Implemented reset reducer to reset authentication state in authSlice.js.
  6. Component Updates

    • Integrated necessary hooks from React, React Redux, and React Router DOM in Register.jsx.
    • Implemented useEffect side effects handling for different registration states in Register.jsx.
    • Implemented registration form submission logic along with user data to handleSubmit in Register.jsx.
    • Added id attributes and matching labels for input elements in Register.jsx.
  7. Store Integration

    • Integrated Provider, store, and index.css in index.js.

Testing

Additional Information