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

[UI] Pass the adding method directly to the 'AddUser' component #97

Open
carma12 opened this issue May 4, 2023 · 2 comments
Open

[UI] Pass the adding method directly to the 'AddUser' component #97

carma12 opened this issue May 4, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@carma12
Copy link
Collaborator

carma12 commented May 4, 2023

The AddUser component receives the following props:

export interface PropsToAddUser {
  show: boolean;
  from: "active-users" | "stage-users" | "preserved-users";
  handleModalToggle: () => void;
}

But these props can be enhanced. For example, the from prop is used only when a specific user is about to be added. And, depending on that, a different 'add' function is used (addActiveUser, addStageUser, or addPreservedUser).

if (props.from === "active-users") {
  dispatch(addActiveUser(userData));
} else if (props.from === "stage-users") {
  dispatch(addStageUser(userData));
} else if (props.from === "preserved-users") {
  dispatch(addPreservedUser(userData));
}

RFE: Instead of passing the from string to determine which 'add' operation to take, it would be better to pass the 'add' function directly to the AddUser component.

@carma12 carma12 added the enhancement New feature or request label May 4, 2023
Copy link

This issue has not received any attention in 120 days.

@github-actions github-actions bot added the stale This PR/issue is stale and will be closed label Dec 11, 2023
@carma12 carma12 removed the stale This PR/issue is stale and will be closed label Dec 11, 2023
Copy link

This issue has not received any attention in 365 days.

@github-actions github-actions bot added the stale This PR/issue is stale and will be closed label Dec 11, 2024
@carma12 carma12 removed the stale This PR/issue is stale and will be closed label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant