Skip to content

Commit 2ab4170

Browse files
committed
attemp to fix TypeError: cats.then is not a function
1 parent c59198f commit 2ab4170

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

chapters/endpoints.qmd

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ lightbox: true
1616
cats = FileAttachment("../_data/cats.json").json()
1717
console.log(cats)
1818
19-
// Create a container div for our carousel
2019
viewof carousel = {
2120
const wrapper = html`<div class="carousel-wrapper"></div>`;
2221
23-
cats.then(data => {
24-
data.forEach(cat => {
25-
const img = document.createElement('img');
26-
img.src = cat.url;
27-
img.alt = 'Cat image';
28-
wrapper.appendChild(img);
29-
});
22+
// No need for .then() as cats is already resolved
23+
cats.forEach(cat => {
24+
const img = document.createElement('img');
25+
img.src = cat.url;
26+
img.alt = 'Cat image';
27+
wrapper.appendChild(img);
3028
});
3129
3230
return wrapper;

0 commit comments

Comments
 (0)