-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[정해찬] sprint5 #91
The head ref may contain hidden characters: "react-\uC815\uD574\uCC2C-sprint5"
[정해찬] sprint5 #91
Changes from all commits
c0d4f95
519ddc9
cbc5e5f
f4c5ff8
829718a
66a0495
e97b8b5
fd0fc33
7a57c7b
019d605
b46ca49
b463e89
1e8f68b
6bfb1e9
2d4acfd
e4f93df
12831cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: PR 자동 라벨링 및 담당자 할당 | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
add-labels-assign: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Add labels and assign PR creator | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
PR_CREATOR=${{ github.event.pull_request.user.login }} | ||
|
||
# Add labels | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels \ | ||
-d '{"labels":["매운맛🔥", "진행 중 🏃"]}' | ||
|
||
# Assign PR creator | ||
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/assignees \ | ||
-d "{\"assignees\":[\"$PR_CREATOR\"]}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
._.DS_Store | ||
**/.DS_Store | ||
**/._.DS_Store |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import axios from "axios"; | ||
|
||
const ARTICLE_BASE_URL = 'https://sprint-mission-api.vercel.app/articles'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. product url 과 main 도메인은 같고, path만 다른 것으로 보입니다. 이런 경우 별도의 파일로 분리하여 관리하는 방법도 생각해 볼 수 있을 것 같습니다. |
||
|
||
axios.interceptors.request.use ( | ||
function(request) { | ||
console.log('Request Interceptor 성공: ',request.method); | ||
return request; | ||
}, | ||
function(error) { | ||
if(error.response) { | ||
console.log('Request Interceptor 에러 발생: ',error.response.status); | ||
return error; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 에러가 발생했을 때는 대응할 수 있도록 코드가 작성되어야 합니다. 지금처럼 error를 반환할 경우 각 코드에서 일일히 에러 대응을 해야하는 등의 코드 중복이 발생할 수 있으며 심지어 정상응답처럼 코드가 동작하여 예기치 못한 상황이 발생할 수도 있습니다. |
||
} | ||
} | ||
) | ||
|
||
axios.interceptors.response.use ( | ||
function(response) { | ||
console.log('Response Interceptor 성공: ',response.status); | ||
console.log(response.data); | ||
return response; | ||
}, | ||
function(error) { | ||
if(error.response) { | ||
console.log('Response Interceptor 에러 발생: ',error.response.status); | ||
return error; | ||
} | ||
} | ||
) | ||
|
||
export async function apiRequest(method,url,data = {},params = {}) { | ||
const config = {method, url, data, params}; | ||
const response = await axios(config); | ||
return response.data; | ||
} | ||
|
||
export async function getArticleList(keyword) { | ||
return apiRequest('GET', ARTICLE_BASE_URL, {},{page:'1',pageSize:'100',keyword}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사소한 부분일 수도 있습니다만 page와 pageSize는 숫자(int)일 가능성이 높기에 문자열 처리를 하지 않는 편이 더 명확할 것 같습니다 |
||
} | ||
|
||
export async function getArticle(id) { | ||
return apiRequest('GET',`${ARTICLE_BASE_URL}/${id}`); | ||
} | ||
|
||
export async function createArticle(title,content,image) { | ||
return apiRequest('POST',ARTICLE_BASE_URL,{title,content,image}); | ||
} | ||
|
||
export async function patchArticle(id,title,content,image) { | ||
return apiRequest('PATCH',`${ARTICLE_BASE_URL}/${id}`,{title,content,image}); | ||
} | ||
|
||
export async function deleteArticle(id) { | ||
return apiRequest('DELETE',`${ARTICLE_BASE_URL}/${id}`); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { apiRequest } from "./ArticleService.js"; | ||
|
||
const PRODUCTS_BASE_URL = 'https://sprint-mission-api.vercel.app/products'; | ||
|
||
export async function getProductList(keyword) { | ||
return apiRequest('GET', PRODUCTS_BASE_URL, {}, {page:'1', pagsSize:'100', keyword}); | ||
} | ||
|
||
export async function getProduct(id) { | ||
return apiRequest('GET',`${PRODUCTS_BASE_URL}/${id}`); | ||
} | ||
|
||
export async function createProduct(name,description,price,manufacturer,tags,images) { | ||
return apiRequest('POST',PRODUCTS_BASE_URL,{name,description,price,manufacturer,tags,images}); | ||
} | ||
|
||
export async function patchProduct(id,name,description,price,tags,images) { | ||
return apiRequest('PATCH',`${PRODUCTS_BASE_URL}/${id}`,{name,description,price,tags,images}); | ||
} | ||
|
||
export async function deleteProduct(id) { | ||
return apiRequest('DELETE',`${PRODUCTS_BASE_URL}/${id}`); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { getArticle, getArticleList, createArticle, patchArticle, deleteArticle } from "./ArticleService.js"; | ||
import { getProduct,getProductList,createProduct, patchProduct, deleteProduct } from "./ProductService.js"; | ||
|
||
getArticle(90); | ||
getArticleList('정몽규'); | ||
createArticle('정해찬','test','test_image'); | ||
patchArticle(776,'patch_정해찬','patch_test','patch_image'); | ||
deleteArticle(776); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitignore는 협업 과정에서 중요한 설정 중 하나입니다. 프로젝트에 맞는 gitignore 설정 방법을 공부하시면 도움이 될 것 같습니다.
참고