Skip to content

Commit 1e1e173

Browse files
committed
Solución reto js gndx#3
1 parent 373b32a commit 1e1e173

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ const getData = async (api) => {
2626
newItem.classList.add("Items");
2727
newItem.innerHTML = output;
2828
$app.appendChild(newItem);
29-
localStorage.setItem(NEXT_KEY, response.info.next);
29+
if(response.info.next)
30+
localStorage.setItem(NEXT_KEY, response.info.next);
31+
else {
32+
alert('Ya no hay más personajes');
33+
intersectionObserver.unobserve($observe);
34+
}
3035
} catch (error) {
3136
console.log(error);
3237
}

0 commit comments

Comments
 (0)