From a16a2cfabf8b2a80d5bfe21633d5bae8cf6a5673 Mon Sep 17 00:00:00 2001 From: Mirlan Date: Thu, 12 Nov 2020 12:35:53 +0600 Subject: [PATCH] feat(#553): go to ext search page on enter press (#218) --- src/features/Search/hooks/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/features/Search/hooks/index.tsx b/src/features/Search/hooks/index.tsx index 877c35da..394921f9 100644 --- a/src/features/Search/hooks/index.tsx +++ b/src/features/Search/hooks/index.tsx @@ -1,11 +1,15 @@ import type { FormEvent } from 'react' import { useCallback, useEffect } from 'react' +import { useHistory } from 'react-router-dom' + +import { PAGES } from 'config' import { useToggle } from 'hooks' import { useExtendedSearchStore } from 'features/ExtendedSearchPage/store' export const useSearch = () => { + const history = useHistory() const { isFetching, onQueryChange, @@ -22,7 +26,8 @@ export const useSearch = () => { const onSubmit = useCallback((e: FormEvent) => { e.preventDefault() - }, []) + history.push(PAGES.extendedSearch) + }, [history]) useEffect(() => { reset()