-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 리스트와 지도 바운더리 내의 레스토랑 연동 기능 구현 (#176)
* feat: LoadingDots 추가 (#171) * refactor: 일부 네이밍 변경 (#171) * chore: 지도에 사용할 svg 추가 (#171) * feat: 기본적인 map ui 구성 (#171) * feat: 리스트와 지도 바운더리 내의 레스토랑 연동 기능 구현 (#169) * feat: fetch함수 추상화 및 적용 (#169) * refactor: onIdle 함수 리팩터링 (#169) * fix: 맵 모달에 이미지 import오류 해결 (#169) --------- Co-authored-by: d0dam <[email protected]>
- Loading branch information
1 parent
0b520ef
commit 9abbbc5
Showing
5 changed files
with
51 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
type FetchMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; | ||
|
||
const useFetch = (endPoint: string) => { | ||
const baseUrl = 'http://3.35.157.27:8080/api/'; | ||
|
||
const handleFetch = async ({ | ||
method = 'GET', | ||
body = {}, | ||
queryString = '', | ||
}: { | ||
method?: FetchMethod; | ||
body?: object; | ||
queryString?: string; | ||
}) => { | ||
const url = `${baseUrl}${endPoint}${queryString && `?${queryString}`}`; | ||
const response = method === 'GET' ? await fetch(url) : await fetch(url, { method, body: JSON.stringify(body) }); | ||
|
||
return response.json(); | ||
}; | ||
|
||
return { handleFetch }; | ||
}; | ||
|
||
export default useFetch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters