Skip to content

Commit

Permalink
fix: 대도시 마커 렌더링 오류를 수정한다 (#846)
Browse files Browse the repository at this point in the history
* refactor: 지역 마커 수신에 대한 에러 핸들링

[#845]

* fix: 잘못 된 url 수정

[#845]
  • Loading branch information
gabrielyoon7 authored Oct 10, 2023
1 parent 68e00d8 commit 5656363
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Region[]>(async (response) => {
const stationMarkers = await fetch(`${SERVER_URL}/stations/regions?regions=all`).then<Region[]>(
async (response) => {
if (!response.ok) {
throw new Error('지역 마커를 수신을 실패했습니다.');
}
const data = await response.json();

return data;
})
.catch((error) => {
throw new Error('지역 마커를 수신을 실패했습니다.', error);
});
}
);

return stationMarkers;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 5656363

Please sign in to comment.