-
Notifications
You must be signed in to change notification settings - Fork 4
Description
๐ฅ TODOS ์์คํ ์ ๋น๋๊ธฐ/์จ์คํ๋ผ์ธ์ ๊ณ ๋ คํ์ฌ ์ ๋ฐ์ดํธํ๊ธฐ
mission001์์ TodoList์ ๊ธฐ๋ณธ์ ์ธ CRUD๋ฅผ ๋ณต์ตํ์๋๋ฐ์. ์ด ๊ธฐ๋ฅ๋ค์ ๋น๋๊ธฐ ํต์ ๊ณผ, ์จ์คํ๋ผ์ธ์ ๊ณ ๋ คํ ๊ธฐ๋ฅ์ ์ถ๊ฐํ๋ ค๊ณ ํฉ๋๋ค. ์๊ตฌ์ฌํญ์ ์๋์ ๊ฐ์ต๋๋ค.
๐ด Missions
fetch๋ฅผ ์ด์ฉํด ๋ฐ์ดํฐ CRUD ํ๊ธฐ
fetch๋ฅผ ์ด์ฉํด Todo ๋ชฉ๋ก data๋ฅผ ๋ถ๋ฌ์ค๊ณ , ํน์ Todo๋ฅผ ์ญ์ ํ๊ณ , ์๋ฃ์ฒ๋ฆฌ๋ฅผ ํ๋ ๊ฒ์ ์ ์ฉํฉ๋๋ค.
json data
{
"_id": ํ ์ผ์ ๊ณ ์ ๊ฐ. ์ซ์์ ๋ฌธ์๊ฐ ์์ฌ์๋ ๋ฌธ์๋ก ๋์ด์์,
"content": ํ ์ผ text,
"isCompleted": ํ ์ผ์ ์๋ฃ์ฌ๋ถ
}1. ๋ถ๋ฌ์ค๊ธฐ
api์๋
username์ด ๋ค์ด๊ฐ๋๋ค. ๋ณธ์ธ์username์ด ๋ค์ด๊ฐ๊ฒ ๋ฃ์ด์ฃผ์ธ์
fetch('http://todo-api.roto.codes/eastjun').then()...2. ์ถ๊ฐํ๊ธฐ
api์๋
username์ด ๋ค์ด๊ฐ๋๋ค. ๋ณธ์ธ์username์ด ๋ค์ด๊ฐ๊ฒ ๋ฃ์ด์ฃผ์ธ์
fetch('http://todo-api.roto.codes/eastjun', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: 'mission review ํ๊ธฐ'
})
}).then(function(){
....
})3. ์ญ์ ํ๊ธฐ
์๋ฒ์์ ๋ถ๋ฌ์จ todo ๋ฐ์ดํฐ์ ์๋ _id๋ฅผ ์ด์ฉํด์ฃผ์ธ์.
fetch('http://todo-api.roto.codes/roto/5d11cf671e050d3f7c583166', {
method: 'DELETE'
}).then(function(){
....
})4. ํ ๊ธ
์๋ฒ์์ ๋ถ๋ฌ์จ todo ๋ฐ์ดํฐ์ ์๋ _id๋ฅผ ์ด์ฉํด์ฃผ์ธ์.
fetch('http://todo-api.roto.codes/roto/5d11cf671e050d3f7c583166/toggle', {
method: 'PUT'
}).then(function(){
....
})5. localStorage์ ๋ฐ์ดํฐ ๋ฃ๊ธฐ
- ํ๋์ฝ๋ฉ ๋ mock๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋ชจ๋ ์ญ์ ํด์ฃผ์ธ์.
localStorage๋ฅผ ํ์ฉํด todo data๊ฐ ๋ณ๊ฒฝ๋ ๋๋ง๋ค localStorage์ ์ ์ฅํฉ๋๋ค.- ํ๋ก๊ทธ๋จ์ ์ด๊ธฐ์ ์ ๊ทผํ ๋ localStorage์ ์ ์ฅํด๋ ๋ฐ์ดํฐ๊ฐ ์๋ค๋ฉด todo data๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
๐จโ๐ป Reviewer Match ๐ฉโ๐ป
์ฝ๋๋ฆฌ๋ทฐ๊ฐ ๋ง๋งํ๋ค๋ฉด ์๋ ๊ฐ์ด๋๋ฅผ ์ฝ์ด๋ณด์๋ฉด ๋์์ด ๋ ๊ฑฐ์์~!
์ฝ๋๋ฆฌ๋ทฐ ๊ฐ์ด๋