fix: 🐛 subscription (#2081)

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):
This commit is contained in:
Stan Girard 2024-01-24 10:49:01 -08:00 committed by GitHub
parent 31ce6c0566
commit eded4d9bdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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";
@ -25,7 +24,6 @@ export const UserToInvite = ({
roleAssignation.role
);
const [email, setEmail] = useState(roleAssignation.email);
const { currentBrain } = useBrainContext();
useEffect(() => {
onChange({
@ -33,13 +31,9 @@ export const UserToInvite = ({
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