Fixed broken favourites in code editor

This commit is contained in:
Dan Brown 2023-05-01 18:43:03 +01:00
parent 8594656f6e
commit cd32597d4d
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -74,8 +74,13 @@ export class CodeEditor extends Component {
onChildEvent(button.parentElement, '.lang-option-favorite-toggle', 'click', () => {
isFavorite = !isFavorite;
const action = isFavorite ? this.favourites.add : this.favourites.delete;
action(language);
if (isFavorite) {
this.favourites.add(language);
} else {
this.favourites.delete(language);
}
button.setAttribute('data-favourite', isFavorite ? 'true' : 'false');
window.$http.patch('/preferences/update-code-language-favourite', {