fix includes

This commit is contained in:
Robin Scholtes 2023-07-24 21:06:47 +12:00
parent 90c66bbc47
commit ebc7ba0761

View file

@ -23,7 +23,7 @@ export class COperationLi extends HTMLElement {
this.includeStarIcon = includeStarIcon; this.includeStarIcon = includeStarIcon;
this.config = this.app.operations[name]; this.config = this.app.operations[name];
this.isFavourite = this.app.isLocalStorageAvailable() && localStorage.favourites?.includes(name); this.isFavourite = this.app.isLocalStorageAvailable() && JSON.parse(localStorage.favourites).indexOf(name) >= 0;
this.build(); this.build();
@ -63,7 +63,6 @@ export class COperationLi extends HTMLElement {
*/ */
handleClick(e) { handleClick(e) {
if (e.target === this.querySelector("i.star-icon")) { if (e.target === this.querySelector("i.star-icon")) {
this.querySelector("li").classList.add("favourite");
this.app.addFavourite(this.name); this.app.addFavourite(this.name);
} }
if (e.target === this.querySelector("i.remove-icon")) { if (e.target === this.querySelector("i.remove-icon")) {