diff --git a/frontend/src/components/google-maps/marker/MaxDeltaAreaMarkerContainer/hooks/useRegionMarkers.ts b/frontend/src/components/google-maps/marker/MaxDeltaAreaMarkerContainer/hooks/useRegionMarkers.ts index 7f6207d7c..df81c25f6 100644 --- a/frontend/src/components/google-maps/marker/MaxDeltaAreaMarkerContainer/hooks/useRegionMarkers.ts +++ b/frontend/src/components/google-maps/marker/MaxDeltaAreaMarkerContainer/hooks/useRegionMarkers.ts @@ -6,15 +6,16 @@ import { SERVER_URL } from '@constants/server'; import type { Region } from '../types'; export const fetchRegionMarkers = async () => { - const stationMarkers = await fetch(`${SERVER_URL}/stations/markers/regions?regions=all`) - .then(async (response) => { + const stationMarkers = await fetch(`${SERVER_URL}/stations/regions?regions=all`).then( + async (response) => { + if (!response.ok) { + throw new Error('지역 마커를 수신을 실패했습니다.'); + } const data = await response.json(); return data; - }) - .catch((error) => { - throw new Error('지역 마커를 수신을 실패했습니다.', error); - }); + } + ); return stationMarkers; }; diff --git a/frontend/src/mocks/handlers/station-markers/stationMarkerHandlers.ts b/frontend/src/mocks/handlers/station-markers/stationMarkerHandlers.ts index 2e7c142e1..9679d5fa3 100644 --- a/frontend/src/mocks/handlers/station-markers/stationMarkerHandlers.ts +++ b/frontend/src/mocks/handlers/station-markers/stationMarkerHandlers.ts @@ -106,7 +106,7 @@ export const stationMarkerHandlers = [ }) ); }), - rest.get(`${DEVELOP_SERVER_URL}/stations/markers/regions`, async (req, res, ctx) => { + rest.get(`${DEVELOP_SERVER_URL}/stations/regions`, async (req, res, ctx) => { const { searchParams } = req.url; const region = searchParams.get('regions');