fix: Flow, remove misused withTranslation on functional component

This commit is contained in:
Tom Moor
2021-07-30 00:52:42 -04:00
parent 37fd7ec97a
commit 63eb8aadaf
2 changed files with 5 additions and 11 deletions

View File

@ -3,12 +3,7 @@ import { find } from "lodash";
import { observer } from "mobx-react";
import { BackIcon, EmailIcon } from "outline-icons";
import * as React from "react";
import {
Trans,
withTranslation,
type TFunction,
useTranslation,
} from "react-i18next";
import { Trans, useTranslation } from "react-i18next";
import { Link, type Location, Redirect } from "react-router-dom";
import styled from "styled-components";
import { setCookie } from "tiny-cookie";
@ -29,12 +24,11 @@ import useStores from "hooks/useStores";
type Props = {|
location: Location,
t: TFunction,
|};
function Login({ location, t }: Props) {
function Login({ location }: Props) {
const query = useQuery();
const { i18n } = useTranslation();
const { t, i18n } = useTranslation();
const { auth } = useStores();
const { config } = auth;
const [emailLinkSentTo, setEmailLinkSentTo] = React.useState("");
@ -278,4 +272,4 @@ const Centered = styled(Flex)`
margin: 0 auto;
`;
export default withTranslation()<Login>(observer(Login));
export default observer(Login);

View File

@ -6,7 +6,7 @@ export function detectLanguage() {
return `${ln}_${region}`;
}
export function changeLanguage(toLanguageString, i18n) {
export function changeLanguage(toLanguageString: ?string, i18n: any) {
if (toLanguageString && i18n.language !== toLanguageString) {
// Languages are stored in en_US format in the database, however the
// frontend translation framework (i18next) expects en-US