-
Notifications
You must be signed in to change notification settings - Fork 37
[박인건] Sprint7, Sprint8 #313
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
[박인건] Sprint7, Sprint8 #313
The head ref may contain hidden characters: "React-\uBC15\uC778\uAC74-sprint8"
Conversation
아직 수정해야할 부분은 많습니다..ㅠ |
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.
고생하셨습니다!
accessToken: string; | ||
}; | ||
|
||
export async function CreateCommentAPI({ |
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.
컴포넌트가 아닌데 이름이 파스칼케이스네요 카멜케이스로 바꿔주세요!
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.
함수의 반환타입도 명시해주면 좋을것 같아요
}: ProductParams) { | ||
const response = await fetch(`${baseURL}/products/${productId}/comments`, { | ||
method: "POST", | ||
body: JSON.stringify({}), |
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.
body가 파라미터로 받는게 아니라 빈객체네요?
export async function GetProductComments({ productId = 1 }) { | ||
const response = await fetch( | ||
`${baseURL}/products/${productId}/comments?limit=10` | ||
); | ||
|
||
if (!response.ok) { | ||
throw new Error("코멘트 정보를 가져오는데 실패했습니다."); | ||
} | ||
const body = await response.json(); | ||
return body; | ||
} |
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.
try{}catch{} 구문을 사용해서 성공과 실패를 나눠서 처리하면 더 좋을것 같아요
Email: string; | ||
Password: string; |
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.
파라미터도 대문자가 아니라 소문자로 시작하는 카멜케이스가 되어야할 것 같습니다.
const [email, setEmail] = useState<string>(""); | ||
const [password, setPassword] = useState<string>(""); |
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.
이건 하나의 객체 상태로 관리하는게 좀더 좋아보이네요 ㅎ
const [state, setState] = useState<{email:string, password:string}>({email:"",password:''});
try { | ||
const data = await SignInAPI({ | ||
Email: email, | ||
Password: password, | ||
}); | ||
console.log("response 확인: ", data); | ||
} catch (error) { | ||
console.error("로그인 실패: ", error); // 콘솔 로그로 에러를 출력 | ||
} |
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.
여기에 사용된 try catch구문은 SignInAPI
내부로 들어가야할 것 같아요
const [productName, setProductName] = useState<string>(); | ||
const [productInfo, setProductInfo] = useState<string>(); | ||
const [productPrice, setProductPrice] = useState<string>(); | ||
const [productTag, setProductTag] = useState<string>(""); | ||
const [preview, setPreview] = useState<string | null>(null); | ||
const [hashTags, setHashTags] = useState<HashTag[]>([]); |
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.
상태를 줄이는 연습을 해보면 좋습니다
Sprint7 요구사항
기본
심화
Sprint8 요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게