fix: the link on the search page corresponds to the domain searched for

This commit is contained in:
Maël Gangloff
2024-12-27 22:16:16 +01:00
parent d3adc4b4ef
commit 0e0a8be0bc
2 changed files with 11 additions and 8 deletions

View File

@@ -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<Domain | null>()
const [messageApi, contextHolder] = message.useMessage()
const navigate = useNavigate()
const {query} = useParams()
const onFinish: FormProps<FieldType>['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 <Flex gap="middle" align="center" justify="center" vertical>

View File

@@ -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."