-
Notifications
You must be signed in to change notification settings - Fork 118
[10기 soonysoo] TodoList with Ajax #100
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
base: soonysoo
Are you sure you want to change the base?
Conversation
dalcon10028
left a comment
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.
안녕하세요!
코드리뷰를 하게된 이연권입니다.
옵저버 패턴에 대해 아직 공부하지 않아 모르지만 알고있는 부분에서 최대한 리뷰해보겠습니다!
|
|
||
| export const userAPI = { | ||
| async getAllUser(){ | ||
| return await fetch(BASE_URL).then(data => data.json()); |
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.
then-catch대신 async-await를 사용 하신 것 같습니다 !
then 사용 대신 변수에 담아서 반환하셔도 될 것 같아요 !
try {
const res = await fetch(BASE_URL);
return res.json();
} catch (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.
그렇네요! async-await적용을 전체를 다 하지못했네요~
수정하겠습니당!
| @@ -0,0 +1,28 @@ | |||
| const HTTP_REQUEST ={ | |||
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.
따로 유틸 파일로 분리하셔서 사용하기 편리해 보입니다!
| update(){ | ||
|
|
||
| } | ||
| } No newline at end of file |
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.
사실 없어도 되지만 observer의 형태라는 의미를 명확히 전달해주기 위해 사용했습니다ㅎㅎ
| async onDeleteAllTodo(){ | ||
| const selectedId = this.selectedUserState.get()._id; | ||
| const response = await todoAPI.deleteAllTodoItem(selectedId); | ||
| if(response.ok){ |
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.
응답코드 체크는 만드신 api파일에서 확인해주시면 더 간결해 보일 것 같습니다!
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.
아 넵~ 수정해야겠네요 ㅎㅎ
hyoungnam
left a comment
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.
조건처리도 깔끔하고 template을 잘 활용하셔서 잘 보고 배워갑니다:)
|
|
||
| mounted(){ | ||
| const toggleBtns = $$('.toggle'); | ||
| toggleBtns.forEach(Btn => Btn.addEventListener('click',this.onToggleTodo.bind(this))); |
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.
모든 btn에 이벤트를 달기보다 이벤트위임을 이용하시는것도 좋을 듯합니다 [https://ko.javascript.info/event-delegation)]
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.
이벤트 위임을 공부하는게 점점 늦어지네요! ㅠㅠ
공부해서 적용해볼게요~
| super(); | ||
| this.state = selectedUserIdState; | ||
| } | ||
| template(){ |
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.
template가 먼저 보이는거 좋아요:)
| templete(){ | ||
| const filter = this.filterState.get(); | ||
| const todo = this.selectedUserState.get().todoList; | ||
| const count = this.counTotalTodo(filter, todo); |
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.
coun 오타가 있습니다
| _edit.forEach((li) => { | ||
| li.classList.remove('editing'); | ||
| }); | ||
| e.target.parentNode.parentNode.classList.add('editing'); |
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.
parentNode를 사용하기보다 직접 $('')을 찾아서 바꿔주는게 이해하기 좋을꺼 같아요
| } | ||
|
|
||
| getRanking(priority){ | ||
| if(priority==PRIORITY.FIRST){ |
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.
의미 전달이 명확한 함수네요!!
안녕하세요 🤗
이번 미션은 Observer 패턴을 이용해서 구현해보았습니다!
observer패턴을 스터디하고 이해하고 구현하는 과정이 어려웠습니다.. 😞
리팩토링은 차후에 진행하여 개선시키겠습니다 👩
###🎯 요구사항
###🎯🎯 심화 요구사항
🕵️♂️ 제약사항