- จงแก้ไขให้โปรแกรมสามารถทำงานได้อย่างถูกต้อง
Tips
- Destructuring
- Promise / Async Await
- Arrays Manuipulation
- To mock an API you need
json-server
to get started
$ npm install -g json-server
$ json-server db.json
Before Edit
searchInput.addEventListener('input', function (e) {
const kw = this.value
alert(kw)
renderProduct()
})
const initializeApplication = function () {
axios
.get('http://localhost:3000/products')
.then(function (response) {
products = response.data
renderProduct()
})
.catch(error => {
console.log(error)
})
}
Result
- สามารถใช้ได้ทุกอย่างจากที่เรียนไป