Skip to content

Commit

Permalink
refactor: 코드 위치 변경
Browse files Browse the repository at this point in the history
- 다른 코드들 처럼 hook끼리 모아두기로 결정

[#927]
  • Loading branch information
feb-dain committed Nov 14, 2023
1 parent 4a52531 commit 4c2c861
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ export const useStationSearchWindow = () => {

const [isFocused, setIsFocused] = useState(false);

const queryClient = useQueryClient();

const [searchWord, setSearchWord] = useState('');
const [debouncedSearchWord, setDebouncedSearchWord] = useState(searchWord);

const { openLastPanel } = useNavigationBar();
const { openStationInfoWindow } = useStationInfoWindow();
const { renderDefaultMarker } = useMarker();

useDebounce(
() => {
setDebouncedSearchWord(searchWord);
},
[searchWord],
400
);

const handleOpenResult = (
event?: MouseEvent<HTMLInputElement> | FocusEvent<HTMLInputElement>
) => {
Expand All @@ -43,19 +60,6 @@ export const useStationSearchWindow = () => {
setIsFocused(false);
};

const queryClient = useQueryClient();

const [searchWord, setSearchWord] = useState('');
const [debouncedSearchWord, setDebouncedSearchWord] = useState(searchWord);

useDebounce(
() => {
setDebouncedSearchWord(searchWord);
},
[searchWord],
400
);

const handleSubmitSearchWord = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();

Expand All @@ -81,10 +85,6 @@ export const useStationSearchWindow = () => {
queryClient.invalidateQueries({ queryKey: [QUERY_KEY_SEARCHED_STATION] });
};

const { openLastPanel } = useNavigationBar();
const { openStationInfoWindow } = useStationInfoWindow();
const { renderDefaultMarker } = useMarker();

const showStationDetails = async ({ stationId, latitude, longitude }: StationPosition) => {
googleMapActions.moveTo({ lat: latitude, lng: longitude });

Expand Down

0 comments on commit 4c2c861

Please sign in to comment.