Skip to content

[ResourceApp][Frontend][REFACTOR] Optimize User Identification with /api/users/me #142

Description

@MohamadNazik

Description:
The UserProvider currently identifies the currentUser by fetching all users from /api/users and matching the email received from the native bridge. With the implementation of the /api/users/me endpoint, this process should be refactored.

Requirements:

  • Add a getMe() method to userApi in features/user/api.ts.
  • Update the fetchUsers logic in features/user/context.tsx to:
    1. Call userApi.getMe() instead of userApi.getUsers() for initial identification.
    2. Assign the result directly to the currentUser state.
  • Remove the "brute-force" email matching logic associated with the global user list.

Success Criteria:

  • Initial application load no longer triggers a full /api/users fetch.
  • currentUser is populated accurately upon login or app refresh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions