- HTML
- generated by pug file (https://pugjs.org/)
- JS
- tasks.js - acync functions
- app.js - initial and observe
- listeners.js - listeners =)
- styles.js - draw card
- CSS
- use SASS
- colors.sass - colors
- style.sass - all another
Url for requests : http://24api.ru/
const data = {
"name": name,
"user_id": userId,
"isDone": 0
}
const response = await fetch("http://24api.ru/rest-todo", {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
if (!response.ok) {
const message = `An error has occured: ${response.status}`;
throw new Error(message);
}
return await response.json();