Skip to content

All Users Page

Documentation: Admin User Management Page

Overview

The Admin User Management Page (AllUsersPage component) is designed for administrative users to manage and view all user accounts within the system. This page is restricted to admin users only.

Features

  • User List Display: Admins can view a list of all users, including names, companies, emails, and roles.
  • Add New User: Functionality to add new users through a form.
  • Navigation to User Details: Clicking on a user row navigates to the user’s detailed page.

Implementation

  • Context: Utilizes UserContext to access the current user’s information.
  • State Management:
    • allUsers: An array of user data fetched from the API.
    • showAddUserForm: Boolean to toggle the display of the add user form.
    • isLoading & error: State variables for managing loading status and error messages.

API Integration

  • getAllUsers: Fetches the list of all users. On success, it updates allUsers; on failure, it sets an error message.
  • Loading & Error Handling: Displays a loading spinner while fetching data and error messages in case of a failure.

User Actions

  • Add User: Opens a form to input new user details. On submission, updates the user list.
  • Retry Fetch: In case of an error, a retry button allows re-fetching user data.

Future Enhancements

  • Improved error handling with more detailed messages.
  • Enhanced UI/UX for better user interaction.
  • Additional features like user role filtering and search functionality.

Note

This page is intended for administrative users only and has appropriate access controls implemented to prevent unauthorized access.