fix search on selected navigation
This commit is contained in:
parent
7e152c1532
commit
656a6e08da
@ -7,6 +7,7 @@ import AsyncSelect from 'react-select/async';
|
|||||||
import './style.css';
|
import './style.css';
|
||||||
import { logoutService } from "../../services";
|
import { logoutService } from "../../services";
|
||||||
import { getSearchLocationService } from "../../services/locations";
|
import { getSearchLocationService } from "../../services/locations";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
|
||||||
function Header() {
|
function Header() {
|
||||||
@ -17,6 +18,7 @@ function Header() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const navigate = useNavigate();
|
||||||
const user = useSelector((state: UserRootState) => state.auth)
|
const user = useSelector((state: UserRootState) => state.auth)
|
||||||
|
|
||||||
const onInput = (val: string): void => {
|
const onInput = (val: string): void => {
|
||||||
@ -38,8 +40,8 @@ function Header() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSelectedSearchOption = (val) => {
|
const onSelectedSearchOption = (val: any) => {
|
||||||
console.log(val)
|
navigate(`/location/${val.value}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onLoadSelectOptions = async (inputValue: string) => {
|
const onLoadSelectOptions = async (inputValue: string) => {
|
||||||
|
@ -196,7 +196,7 @@ function LocationDetail() {
|
|||||||
if(updatePage) {
|
if(updatePage) {
|
||||||
getLocationDetail()
|
getLocationDetail()
|
||||||
}
|
}
|
||||||
}, [updatePage])
|
}, [updatePage, id])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user