fix search on selected navigation

This commit is contained in:
NCanggoro 2024-03-04 16:19:04 +07:00
parent 7e152c1532
commit 656a6e08da
2 changed files with 5 additions and 3 deletions

View File

@ -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) => {

View File

@ -196,7 +196,7 @@ function LocationDetail() {
if(updatePage) { if(updatePage) {
getLocationDetail() getLocationDetail()
} }
}, [updatePage]) }, [updatePage, id])
return ( return (
<> <>