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 {DomainSearchBar, FieldType} from "../../components/search/DomainSearchBar";
|
||||||
import {DomainResult} from "../../components/search/DomainResult";
|
import {DomainResult} from "../../components/search/DomainResult";
|
||||||
import {showErrorAPI} from "../../utils/functions/showErrorAPI";
|
import {showErrorAPI} from "../../utils/functions/showErrorAPI";
|
||||||
import {useParams} from "react-router-dom";
|
import {useNavigate, useParams} from "react-router-dom";
|
||||||
|
|
||||||
export default function DomainSearchPage() {
|
export default function DomainSearchPage() {
|
||||||
const [domain, setDomain] = useState<Domain | null>()
|
const [domain, setDomain] = useState<Domain | null>()
|
||||||
const [messageApi, contextHolder] = message.useMessage()
|
const [messageApi, contextHolder] = message.useMessage()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const {query} = useParams()
|
const {query} = useParams()
|
||||||
|
|
||||||
const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
|
const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
|
||||||
|
navigate('/search/domain/' + values.ldhName)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (query === undefined) return
|
||||||
|
|
||||||
setDomain(null)
|
setDomain(null)
|
||||||
getDomain(values.ldhName).then(d => {
|
getDomain(query).then(d => {
|
||||||
setDomain(d)
|
setDomain(d)
|
||||||
messageApi.success(t`Found !`)
|
messageApi.success(t`Found !`)
|
||||||
}).catch((e: AxiosError) => {
|
}).catch((e: AxiosError) => {
|
||||||
setDomain(undefined)
|
setDomain(undefined)
|
||||||
showErrorAPI(e, messageApi)
|
showErrorAPI(e, messageApi)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (query) onFinish({ldhName: query})
|
|
||||||
}, [query])
|
}, [query])
|
||||||
|
|
||||||
return <Flex gap="middle" align="center" justify="center" vertical>
|
return <Flex gap="middle" align="center" justify="center" vertical>
|
||||||
|
|||||||
@@ -515,11 +515,11 @@ msgstr ""
|
|||||||
msgid "Sorry, the page you visited does not exist."
|
msgid "Sorry, the page you visited does not exist."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/pages/search/DomainSearchPage.tsx:21
|
#: assets/pages/search/DomainSearchPage.tsx:28
|
||||||
msgid "Found !"
|
msgid "Found !"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/pages/search/DomainSearchPage.tsx:41
|
#: assets/pages/search/DomainSearchPage.tsx:44
|
||||||
msgid ""
|
msgid ""
|
||||||
"Although the domain exists in my database, it has been deleted from the "
|
"Although the domain exists in my database, it has been deleted from the "
|
||||||
"WHOIS by its registrar."
|
"WHOIS by its registrar."
|
||||||
|
|||||||
Reference in New Issue
Block a user