Skip to content

Commit

Permalink
Favourite-Done
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaykumar007 committed Nov 6, 2021
1 parent a70146c commit f82a5db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ async function handelFav(id) {
const url = `https://superheroapi.com/api.php/1699068923618895/${id}`;
let response = await fetch(url);
const data = await response.json();
favList.push(data);
const ref = JSON.parse(localStorage.getItem("favList"));
favList = [...ref, data];
localStorage.setItem("favList", JSON.stringify(favList));
}

function setFavList() {
const ref = JSON.parse(localStorage.favList);
console.log(ref);
Expand Down

0 comments on commit f82a5db

Please sign in to comment.