All files / src/components/common/Settings/NewChangeEmail NewchangeEmailModal.tsx

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                      3x 57x 57x   57x         14x              
import NiceModal from "@ebay/nice-modal-react";
import { useAppSelector } from "@redux/hooks";
import { selectUser } from "@redux/slices/auth/auth";
import ChangeEmailModal from "componentsV2/AccountProfile/AccountDetails/ChangeEmailModal";
import VerifyIdentityModal from "componentsV2/AccountProfile/AccountDetails/VerifyIdentityModal";
import { useState } from "react";
 
type Props = {
  sendCodeOnMount?: boolean;
};
 
const NewChangeEmailModal = NiceModal.create(({ sendCodeOnMount }: Props) => {
  const [passwordChecked, setPasswordChecked] = useState<boolean>(false);
  const { email } = useAppSelector(selectUser);
 
  return passwordChecked ? (
    <ChangeEmailModal setPasswordChecked={setPasswordChecked} />
  ) : (
    <VerifyIdentityModal
      email={email}
      onSuccessFn={() => setPasswordChecked(true)}
      sendCodeOnMount={sendCodeOnMount}
    />
  );
});
 
export default NewChangeEmailModal;