mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: the link on the search page corresponds to the domain searched for
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user