Refactors useLocale (#908)
* Removes unused component * Refactors useLocale We don't need to pass the locale prop everywhere * Fixes syntax error * Adds warning for missing localeProps * Simplify i18n utils * Update components/I18nLanguageHandler.tsx Co-authored-by: Mihai C <34626017+mihaic195@users.noreply.github.com> * Type fixes Co-authored-by: Mihai C <34626017+mihaic195@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,6 @@ interface EnableTwoFactorModalProps {
|
||||
* Called when the user enables two-factor auth
|
||||
*/
|
||||
onEnable: () => void;
|
||||
localeProp: string;
|
||||
}
|
||||
|
||||
enum SetupStep {
|
||||
@@ -47,7 +46,7 @@ const WithStep = ({
|
||||
return step === current ? children : null;
|
||||
};
|
||||
|
||||
const EnableTwoFactorModal = ({ onEnable, onCancel, localeProp }: EnableTwoFactorModalProps) => {
|
||||
const EnableTwoFactorModal = ({ onEnable, onCancel }: EnableTwoFactorModalProps) => {
|
||||
const [step, setStep] = useState(SetupStep.ConfirmPassword);
|
||||
const [password, setPassword] = useState("");
|
||||
const [totpCode, setTotpCode] = useState("");
|
||||
@@ -55,7 +54,7 @@ const EnableTwoFactorModal = ({ onEnable, onCancel, localeProp }: EnableTwoFacto
|
||||
const [secret, setSecret] = useState("");
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
const { t } = useLocale({ localeProp });
|
||||
const { t } = useLocale();
|
||||
|
||||
async function handleSetup(e: SyntheticEvent) {
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user