Skip to content
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

Roll Up isAdmin State Across the Codebase Using Zustand #165

Open
govindup63 opened this issue Jan 7, 2025 · 1 comment
Open

Roll Up isAdmin State Across the Codebase Using Zustand #165

govindup63 opened this issue Jan 7, 2025 · 1 comment
Assignees
Labels
Backend Backend issue using Typescript

Comments

@govindup63
Copy link
Contributor

Problem Description

Currently, the isAdmin state is being managed inconsistently across the codebase. This inconsistency causes issues such as:

  • Components not rerendering when the isAdmin state changes.
  • Persistent admin access even after actions like logout, leading to potential security risks.

Proposed Solution

  • Use the existing Zustand state management file to centralize the isAdmin state.
  • Ensure all components that rely on the isAdmin state subscribe to it via the Zustand store.
  • Whenever the isAdmin state changes, all subscribed components should rerender automatically to reflect the updated state.

Expected Behavior

  • On any update to the isAdmin state (e.g., during login or logout), all relevant components should react to the change and update accordingly.
  • After logging out, the user should no longer have admin access, ensuring proper security behavior.

Steps to Implement

  1. Add the isAdmin state to the Zustand store.
  2. Replace any local isAdmin state management in components with the Zustand implementation.
  3. Test the functionality to ensure:
    • Components rerender as expected when the isAdmin state changes.
    • Admin access is revoked upon logout.
@govindup63 govindup63 changed the title Roll up isAdmin state Variable using Zustand Roll Up isAdmin State Across the Codebase Using Zustand Jan 7, 2025
@Adit-K06
Copy link

Adit-K06 commented Jan 7, 2025

Assigned to me bhaiya! Will learn and try to complete as soon as possible!

@SkySingh04 SkySingh04 added the Backend Backend issue using Typescript label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Backend issue using Typescript
Projects
None yet
Development

No branches or pull requests

3 participants