목록Firestore (4)
Frontend 개발자 - hyo.loui
🎯목적 : CRUD : Update API 생성 , Firebase : FireStore data 업데이트 🤢 오류 해결 : WARN Possible Unhandled Promise Rejection : TypeError: _n7.indexOf is not a function. 1. setDone (체크아이콘) 체크 아이콘을 누르면 함수가 실행되어 해당하는 todo의 isDone 속성을 토글로 변경하고, isDone이 true 라면 완료했다는 효과(text-decoration: line-through)를 주자 아이콘 클릭 시 실행되는 함수이고, 서버통신을 하는 부분이니 비동기 처리를 해줬다. 또 현재 가지고 있는 todos의 isDone을 토글해야 했기 때문에 find 라는 변수로 지금 가진 isDone..
❤️🔥TIL : Today I Learned 🎯목적 : CRUD : Read API 추가, onSnapshot API 활용하기 1. Firestore 의 DB 가져오기 저번 포스팅에서 Creat API를 만들어 Firestore에 "todos" 라는 db를 넣을 수 있었다 이번에는 가져와서 보여줘야한다! firebase API 활용하자! 선택지는 2가지다 getDocs API onSnapshot API getDocs로도 가져올 수 있겠지만 우리는 실시간으로 변동이 생기면 다시 데이터를 가져와야 하므로 state 처럼 사용해야 한다. 그래서 onSnapshot API 를 활용했다! import { onSnapshot } 으로 api를 가져온다 useEffect를 사용하여 컴포넌트가 마운트시 곧장 Read..
🎯목적 : CRUD : Create API 추가, Firebase : FireStore 연결 1. Layout 만들기 위와 같은 레이아웃을 만들어 보겠다! 사실 '투두리스트'를 많이 만들어서 캠프 커리큘럼, 학습의 다양성에 의문점이 있었지만, 프론트엔드 개발자의 기본 자질인 CRUD의 기본기를 가장 핵심적으로 다루는 학습이라고 생각한다. 다시한번 복습하자면, ios에서 카메라 영역으로 인해 layout이 가려지는 문제로 태그를 사용해준다! 안드로이드에서는 문제가 없지만 첫 작업은 보통 ios로 작업을 해야 2중 작업이 줄어든다 그래서 '노치 제거' 라는 주석으로 태그 사용의 이유를 주석으로 설명했다. 크게 두 섹션으로 나눌 수 있는데 위 사진에서 알수 있듯, 고정 영역(Fiexd Part) & 스크롤 영..
Read API 게시글을 조회하고, 보여주는 함수이다 우선은 게시글을 클릭했을 때 우리가 가진 데이터를 보여주려면 id 가 필요했다 id 안에 게시글이 객체형태로 데이터가 들어있기 때문이다 우선 게시글에 삽입 될 HTML 태그이다 /* ...innerHTML */ fanPickList 객체가 가지고있는 id 데이터를 태그 id에 넣어주고 onclick 으로 전달되도록 구현했다. onclick="sendId(${fanPickList.id})" 처음에는 위 처럼 해당아이디를 바로 클릭하면 전달 할 수 있게 작성했으나, 레퍼런스 에러가 나서 수정했다 // 클릭한 카드의 id 받아적는 변수 let selectId = ""; // 함수가 실행 될 때마다, 해당게시글 id 를 update export functio..