Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

fix: optimistically ignore video, then consolidate

Christian Fei119fc1f4c201
diff --git a/client/components/video-element.js b/client/components/video-element.js
index 435c0ce..43dfcd0 100644
--- a/client/components/video-element.js
+++ b/client/components/video-element.js
@@ -169,16 +169,16 @@ class VideoElement extends HTMLElement {
toggleIgnoreVideoHandler (event) {
event.preventDefault()
- this.video.ignored = !this.video.ignored
- this.render()
-
+
fetch('/api/ignore-video', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: this.video.id }),
})
+ .then(() => this.remove())
.catch((error) => {
console.error('Error ignoring video:', error)
+ this.classList.remove('hide')
this.render()
})
}