diff --git a/assets/pages/search/DomainSearchPage.tsx b/assets/pages/search/DomainSearchPage.tsx index c30585c..c263d18 100644 --- a/assets/pages/search/DomainSearchPage.tsx +++ b/assets/pages/search/DomainSearchPage.tsx @@ -6,27 +6,30 @@ import {t} from 'ttag' import {DomainSearchBar, FieldType} from "../../components/search/DomainSearchBar"; import {DomainResult} from "../../components/search/DomainResult"; import {showErrorAPI} from "../../utils/functions/showErrorAPI"; -import {useParams} from "react-router-dom"; +import {useNavigate, useParams} from "react-router-dom"; export default function DomainSearchPage() { const [domain, setDomain] = useState() const [messageApi, contextHolder] = message.useMessage() + const navigate = useNavigate() const {query} = useParams() const onFinish: FormProps['onFinish'] = (values) => { + navigate('/search/domain/' + values.ldhName) + } + + useEffect(() => { + if (query === undefined) return + setDomain(null) - getDomain(values.ldhName).then(d => { + getDomain(query).then(d => { setDomain(d) messageApi.success(t`Found !`) }).catch((e: AxiosError) => { setDomain(undefined) showErrorAPI(e, messageApi) }) - } - - useEffect(() => { - if (query) onFinish({ldhName: query}) }, [query]) return diff --git a/translations/translations.pot b/translations/translations.pot index 53eab27..af50658 100644 --- a/translations/translations.pot +++ b/translations/translations.pot @@ -515,11 +515,11 @@ msgstr "" msgid "Sorry, the page you visited does not exist." msgstr "" -#: assets/pages/search/DomainSearchPage.tsx:21 +#: assets/pages/search/DomainSearchPage.tsx:28 msgid "Found !" msgstr "" -#: assets/pages/search/DomainSearchPage.tsx:41 +#: assets/pages/search/DomainSearchPage.tsx:44 msgid "" "Although the domain exists in my database, it has been deleted from the " "WHOIS by its registrar."