Skip to content

Commit

Permalink
fix: 🐛 subscription (#2081)
Browse files Browse the repository at this point in the history
error in role assignment

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
StanGirard authored Jan 24, 2024
1 parent 31ce6c0 commit eded4d9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions frontend/lib/components/UserToInvite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { MdOutlineRemoveCircle } from "react-icons/md";

import Field from "@/lib/components/ui/Field";
import { Select } from "@/lib/components/ui/Select";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";

import { BrainRoleAssignation, BrainRoleType } from "./BrainUsers/types";
import { userRoleToAssignableRoles } from "./ShareBrain/types";
Expand All @@ -25,21 +24,16 @@ export const UserToInvite = ({
roleAssignation.role
);
const [email, setEmail] = useState(roleAssignation.email);
const { currentBrain } = useBrainContext();

useEffect(() => {
onChange({
...roleAssignation,
email,
role: selectedRole,
});
}, [email, selectedRole]);
}, [email, onChange, roleAssignation, selectedRole]);

if (currentBrain === undefined) {
return <div />;
}

const assignableRoles = userRoleToAssignableRoles[currentBrain.role];
const assignableRoles = userRoleToAssignableRoles["Owner"];
const translatedOptions = assignableRoles.map((role) => ({
value: role.value,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand Down

0 comments on commit eded4d9

Please sign in to comment.