Skip to content

Commit

Permalink
If member email is not confirmed, don't enable submit button
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi committed Mar 27, 2024
1 parent b89d78a commit a87bb37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/members/MemberForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default function MemberForm({ defaultValues = {}, action = "log" }) {
const router = useRouter();
const { user } = useAuth();

const [userMember, setUserMember] = useState(null);
const [loading, setLoading] = useState(false);
const [cancelDialog, setCancelDialog] = useState(false);
const [positionEditing, setPositionEditing] = useState(false);
Expand Down Expand Up @@ -175,6 +176,8 @@ export default function MemberForm({ defaultValues = {}, action = "log" }) {
control={control}
watch={watch}
setValue={setValue}
user={userMember}
setUser={setUserMember}
/>
</Grid>
</Grid>
Expand Down Expand Up @@ -250,7 +253,7 @@ export default function MemberForm({ defaultValues = {}, action = "log" }) {
variant="contained"
color="primary"
fullWidth
disabled={positionEditing}
disabled={positionEditing || !userMember}
>
Save
</LoadingButton>
Expand All @@ -264,12 +267,11 @@ export default function MemberForm({ defaultValues = {}, action = "log" }) {
}

// find user by email
function MemberUserInput({ control, watch, setValue }) {
function MemberUserInput({ control, watch, setValue, user, setUser }) {
const { triggerToast } = useToast();

const uid = watch("uid");
const emailInput = watch("userSelector");
const [user, setUser] = useState(null);
useEffect(() => {
(async () => {
if (uid) await getUser();
Expand Down

0 comments on commit a87bb37

Please sign in to comment.