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 <[email protected]>

* Type fixes

Co-authored-by: Mihai C <[email protected]>
This commit is contained in:
Omar LópezandMihai C authored and GitHub committed 2021-10-12 13:11:33 +00:00
1 parent 7dd6fdde7a
commit cfd70172f0
35 files changed
+366 -440

No files matched your search

+4 -10
View File
@@ -10,23 +10,17 @@ import TwoFactorAuthAPI from "./TwoFactorAuthAPI";
import TwoFactorModalHeader from "./TwoFactorModalHeader";
interface DisableTwoFactorAuthModalProps {
/**
* Called when the user closes the modal without disabling two-factor auth
*/
/** Called when the user closes the modal without disabling two-factor auth */
onCancel: () => void;
/**
* Called when the user disables two-factor auth
*/
/** Called when the user disables two-factor auth */
onDisable: () => void;
localeProp: string;
}
const DisableTwoFactorAuthModal = ({ onDisable, onCancel, localeProp }: DisableTwoFactorAuthModalProps) => {
const DisableTwoFactorAuthModal = ({ onDisable, onCancel }: DisableTwoFactorAuthModalProps) => {
const [password, setPassword] = useState("");
const [isDisabling, setIsDisabling] = useState(false);
const [errorMessage, setErrorMessage] = useState<string | null>(null);
const { t } = useLocale({ localeProp });
const { t } = useLocale();
async function handleDisable(e: SyntheticEvent) {
e.preventDefault();