AddNewFactorModal() — supabase Function Reference
Architecture documentation for the AddNewFactorModal() function in AddNewFactorModal.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/studio/components/interfaces/Account/TOTPFactors/AddNewFactorModal.tsx lines 21–54
export const AddNewFactorModal = ({ visible, onClose }: AddNewFactorModalProps) => {
// Generate a name with a number between 0 and 1000
const [name, setName] = useState(`App ${Math.floor(Math.random() * 1000)}`)
const { data, mutate: enroll, isPending: isEnrolling, reset } = useMfaEnrollMutation()
useEffect(() => {
// reset has to be called because the state is kept between if the process is canceled during
// the second step.
if (!visible) {
setName(`App ${Math.floor(Math.random() * 1000)}`)
reset()
}
}, [reset, visible])
return (
<>
<FirstStep
visible={visible && !Boolean(data)}
name={name}
setName={setName}
enroll={enroll}
isEnrolling={isEnrolling}
onClose={onClose}
/>
<SecondStep
visible={visible && Boolean(data)}
factorName={name}
factor={data as Extract<typeof data, { type: 'totp' }>}
isLoading={isEnrolling}
onClose={onClose}
/>
</>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free