-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from delicious-algorithme/dev
feat: creat api 후 main 으로 머지
- Loading branch information
Showing
18 changed files
with
596 additions
and
306 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.env |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,68 @@ | ||
import { defaultInstance } from '../utils/instance'; | ||
|
||
//category 검색 가게 리스트 | ||
export const getStoreList = async (params) => { | ||
console.log(params); | ||
try { | ||
const { data, status } = await defaultInstance.get(`api/stores/search`, { params: params }); | ||
return { | ||
data, | ||
status, | ||
}; | ||
} catch (e) { | ||
console.log(e); | ||
return { | ||
error: e.response.data.detail, | ||
status: e.response.status, | ||
}; | ||
} | ||
}; | ||
//nearby_station 검색 가게 리스트 | ||
export const getStationStoreList = async (params) => { | ||
try { | ||
const { data, status } = await defaultInstance.get(`api/stores/search/nearby_station`, { params: params }); | ||
return { | ||
data, | ||
status, | ||
}; | ||
} catch (e) { | ||
console.log(e); | ||
return { | ||
error: e.response.data.detail, | ||
status: e.response.status, | ||
}; | ||
} | ||
}; | ||
//name 검색 가게리스트 | ||
export const getNameStoreList = async (params) => { | ||
try { | ||
const { data, status } = await defaultInstance.get(`api/stores/search/name`, { params: params }); | ||
return { | ||
data, | ||
status, | ||
}; | ||
} catch (e) { | ||
console.log(e); | ||
return { | ||
error: e.response.data.detail, | ||
status: e.response.status, | ||
}; | ||
} | ||
}; | ||
// 가게 상세 정보 | ||
export const getStoreDetail = async (id) => { | ||
console.log('Store ID:', id); | ||
try { | ||
const { data, status } = await defaultInstance.get(`api/stores/${id.storeId}`); | ||
return { | ||
data, | ||
status, | ||
}; | ||
} catch (e) { | ||
console.log(e); | ||
return { | ||
error: e.response.data.detail, | ||
status: e.response.status, | ||
}; | ||
} | ||
}; |
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,3 @@ | ||
import defaultInstance from './instance'; | ||
|
||
export { defaultInstance }; |
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,12 @@ | ||
import axios from 'axios'; | ||
const REACT_APP_BackEndUrl = process.env.REACT_APP_BackEndUrl; // 나중에 환경변수로 바꾸기 | ||
|
||
const Api = axios.create({ | ||
baseURL: REACT_APP_BackEndUrl, | ||
headers: { | ||
'Content-Type': `application/json`, | ||
}, | ||
}); | ||
|
||
export const defaultInstance = Api; | ||
//일단 어떤 데이터들 받아야하는지 정리 |
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
Oops, something went wrong.